How to overwrite template.php file

Got it. In your parent template.php. Some function were not wrapped in: if( !function_exists(‘function_name’) ) { // function content } So you won’t able to override that function. Make sure to wrap parent function that tend to be override in child by above code. FYI, for function, you don’t need to create a file with … Read more

Custom posts password protect

Use post_password_required() function to check if the post is protected. <?php global $post; $p = $post; // can be post object. // $p = $post->ID; // also can be post ID. $this_post_type = get_post_type( $p ); if ( ‘my_custom_post_type’ === $this_post_type ) { // check the post type. if ( ! post_password_required( $p ) ) … Read more

How can I use custom menus with a Bootstrap WordPress theme?

You can change the classes of the <ul> by adding ‘menu_class’=>’nav navbar-nav’ to your $args array. Remember, this parameter overwrites all the classes, so add “menu” as well if you want many themes and plugins to work! If you don’t want the outer <div>, you can “unwrap” the <ul> by adding ‘container’=>false. $args = array( … Read more

Is it advisable to use $post->comment_count instead of get_comments_number( $post_id )

This is that classic question, do you have 6 eggs or half a dozen, and frankly, it doesn’t actually matter. It is however better to use get_comments_number() because the post object is retrieved from the $GLOBALS[‘post’] global which is set by the_post() inside the loop the post object is validated through WP_Post (through get_post()) the … Read more

Warning: call_user_func() expects parameter 1 to be a valid callback, function

I just found the solution. use this code instead public function register_voguepay_woocommerce_payouts_dashboard_widget(){ add_meta_box( ‘withdraw_to_bank’, ‘Withdraw to Bank’, array($this, ‘voguepay_woocommerce_payouts_dashboard_widget_display’), ‘dashboard’, ‘side’, ‘high’ ); } public function voguepay_woocommerce_payouts_dashboard_widget_display(){ echo “Hello World, I’m a great Dashboard Widget”; }

Suggest Users basing on User taxonomy

You cannot query users by taxonomy. You will need to rethink your system. What would I do? Keep the taxonomies but use these only to output choosable values – wp_dropdown_categories() Save the selected value AS user meta, NOT AS taxonomies – update_user_meta() Now you can query users by that value – WP_User_Query() Example: This code … Read more

How can I change the size of the text in Word Press

First of all, remember that html is for adding meaning and css appearance. If you want to change the text size for sematic reasons, like “this text is a subsection title” or “this sentence is very important”, I would advice you not to use <span style=”font-size: xx”>. It’s a better practice for those cases to … Read more