Archive for the ‘quick fix’ Category

quick fix, wordpress | No Comments | August 9th, 2014

You may want edit the .htaccess file instead of doing it to your php.ini file. most wp install are hosted on a sharing environment and with no access to the php.ini at all.

just copy and paste the code below to your .htaccess file

########
php_value upload_max_filesize 50M
php_value post_max_size 50M
php_value max_execution_time 500
php_value max_input_time 500
#########

Add this PHP code in functions.php file.

 

add_filter( ‘the_content’, ‘prefix_insert_post_ads’ );

function prefix_insert_post_ads( $content ) {

$ad_code = ‘<div> You can add ads code here </div>';

if ( is_single() && ! is_admin() ) {
return prefix_insert_after_paragraph( $ad_code, 1, $content );
}

return $content;
}

// Parent Function that makes the magic happen

function prefix_insert_after_paragraph( $insertion, $paragraph_id, $content ) {
$closing_p = ‘</p>';
$paragraphs = explode( $closing_p, $content );
foreach ($paragraphs as $index => $paragraph) {

if ( trim( $paragraph ) ) {
$paragraphs[$index] .= $closing_p;
}

if ( $paragraph_id == $index + 1 ) {
$paragraphs[$index] .= $insertion;
}
}

return implode( ”, $paragraphs );
}

quick fix, regex | No Comments | July 18th, 2013

include(‘simple_html_dom.php’);
function nestedHTML($node)
{
$doc = $node->ownerDocument;
$frag = $doc->createDocumentFragment();
foreach ($node->childNodes as $child)
{
$frag->appendChild($child->cloneNode(TRUE));
}
return $doc->saveXML($frag);
}
//$html = “<div class=’xyz’><div class=’abc’>contents</div></div>”;  // Add html here
libxml_use_internal_errors(true); // if any warning generate
$doc = new DOMDocument();
$doc->loadHTML($html);
$doc->saveHTML();
$nodes = $doc->getElementsByTagName(‘div’);
foreach ($nodes as $node) {
$class = $node->getAttribute(‘class’);
if($class == ‘entry-content’){   // add class there
echo nestedHTML($node);
}
}

quick fix, wordpress | No Comments | June 12th, 2013

The edit author attribute is not added by default in for custom post types. To add the author attribute the following code is required:

please add this code to function.php in theme folder.

function allowAuthorEditing()
{
  add_post_type_support( 'mytype', 'author' );
}

add_action('init','allowAuthorEditing');

quick fix, wordpress | No Comments | May 23rd, 2013

Please  delete  blank spaces at the top and bottom of functions.php in your theme folder…

Mode rewrite, quick fix | No Comments | April 26th, 2013

open .htaccess file and paste this code on top.

<FilesMatch “.*\.(htm|html|php)$”>
SetHandler application/x-httpd-php5
</FilesMatch>

quick fix, wordpress | No Comments | January 31st, 2013

PLease add this code in function.php file from your active Theme folder

 

function szub_nofollow_tag($text) {
return str_replace(‘<a href=’, ‘<a rel=”nofollow” href=’, $text);
}

add_filter(‘wp_tag_cloud’, ‘szub_nofollow_tag’);   /* Will add no follow in tag Cloud */
add_filter(‘the_tags’, ‘szub_nofollow_tag’); /* Will add no follow in Post Tags */