How to use a variable as a function name?

<?php $numcpost = of_get_option(‘how_many_custom_posts’); do { add_action( ‘init’, ‘register_cpt_mdframework_price’, $numcpost ); –$numcpost; } while ( $numcpost > 0 ); function register_cpt_mdframework_price( $numcpost ) { $singcpost = of_get_option(‘custom_posts_name_s_n’.$numcpost.”); $plurcpost = of_get_option(‘custom_posts_name_p_n’.$numcpost.”); $desccpost = of_get_option(‘custom_posts_name_d_n’.$numcpost.”); $imgcpost = of_get_option(‘custom_posts_name_i_n’.$numcpost.”); $labels = array(); // labels for $numcpost = 1 $labels[1] = array(/*typo was here*/ ‘name’ => _x( $plurcpost, ‘mdframework_custom_created_post’.$numcpost.” … Read more

Removing the comment function within wordpress

Will unchecking these options not satisfy your needs (especially the last one)? Attempt to notify any blogs linked to from the article Allow link notifications from other blogs (pingbacks and trackbacks) Allow people to post comments on new articles All can be found at the top of the Discussion Settings page.

customize wordpress database error page

This works fine for me as db-error.php in wp-content: Delete the mailer block if you don’t want it <?php header(‘HTTP/1.1 503 Service Temporarily Unavailable’); ?> <?php $to = “[email protected]”; $subject = “My Database is down”; $message = “My Database is down”; $headers = “MIME-Version: 1.0\n”; $headers .= “Content-type: text/plain; charset=iso-8859-1\n”; $headers .= “X-Mailer: php\n”; $headers … Read more

Theme not calling Jquery properly

If you register a script with wp_register_script() it is not neccessary to pass all the options in wp_enqueue_script() again. You can register the script in a central place and use the enqueueing it in diffenrent files. functions.php wp_register_script( ‘theme_script’, ‘path/to/script.js’, array( [dependencies] ), ‘1.0’, true ); […] if ( $condition ) require_once ‘file1.php’; else require_once … Read more

Different Subdomain changes page content

Just check the current host: add_filter( ‘the_content’, ‘domain_dependent_content’ ); function domain_dependent_content( $content ) { // get_the_ID() will return the current post ID if you need // more information about the current page. if ( ‘page’ !== get_post_type() ) return $content; if ( ‘au.example.com’ === $_SERVER[‘HTTP_HOST’] ) return “G’Day buddy!<br>$content”; if ( ‘uk.example.com’ === $_SERVER[‘HTTP_HOST’] ) … Read more

Get post meta retrieving wrong value

Please take some time to read the Codex. the_ID echos content. That means that the ID is never being passed to get_post_meta. It is just echoed in place. From the same Codex Page: Note: This function displays the ID of the post, to return the ID use get_the_ID(). So, use get_the_ID instead. Second problem… quote … Read more

Custom Post not working as expected

Ok, I solved it, maybe instead of asking I should drink 1 more coffe or sleep something more, anyway the solution is to move this part: $singcpost = of_get_option(‘custom_posts_name_s_n1’); $plurcpost = of_get_option(‘custom_posts_name_p_n1’); $desccpost = of_get_option(‘custom_posts_name_d_n1’); $imgcpost = of_get_option(‘custom_posts_name_i_n1’); After the opening function… Here is the corrected code: <?php /* IF 1 Start */ add_action( ‘init’, … Read more

If ‘editor’ is empty, then

I’m using something of the sorts for delivering some standard default text if the post content is empty. Give this a whirl: <?php if( $post->post_content != “” ) { //do something or show content } else { //do something else }?>

Adding a line of text to php code

There is a difference between the home page and the front page. Since the code uses is_front_page I assume that is what you want, but check the Codex for the difference. I don’t know how your theme works, but it looks like the theme rolls several things into the “info bar”. The code you posted … Read more