How to show the amount of post that have on the site?

Using a query could give you easier customization without having to use SQL directly. $posts = get_posts( array( ‘post_type’ => ‘post’, ‘post_status’ => ‘any’, ‘numberposts’ => -1, ‘fields’ => ‘ids’, )); $total_count = count( $posts ); print_r ( $total_count );

Sort wordpress posts by facebook likes [closed]

You can either sort them with jQuery on the front-end, or pull the like count into the back-end and store on the post_meta. Then sort by meta value in your loop. FACEBOOK http://graph.facebook.com/?id=http://{URL} Result { “id”: “http://{URL}”, “shares”: intgr/(number) } Other types of share counts.

Hamburger Navigation Menu

You could solve this with other nasty hacks but here’s kind of WordPress way: In your header.php <?php // User is not using mobile if( ! wp_is_mobile() ) { wp_nav_menu(); // Your “original menu” } // User is using mobile else if( wp_is_mobile() ) { wp_nav_menu(); // Your another menu that only has top level … Read more

Order shipped by which driver[hook for woocoomerce order staus changed and popup in admin panel ] [closed]

Please go through the code below. I have tried and tested 🙂 /** * Adds a box to the side column on the Order edit screens. * It checks if the order status is completed & then adds meta box. */ function add_drivers_meta_box() { global $current_screen; /* In the second condistion below, please change it … Read more

How to get value from wp_usermeta table in database?

You should be using add_user_meta instead of update_user_meta: if (isset($_POST[‘billing_cpf’])) { add_user_meta($customer_id, ‘billing_cpf’, $POST[‘billing_cpf’], true); } As this will only add the meta if it does not already exist – no update. (This will prevent this field from being updatable – unless by you another way.) Note: normally you could use something like this to … Read more

How to include a new file in theme

Lets take a look in the twentysixteen theme. Line 18/19 (inside the loop) of single.php shows actualy all you need/want to know, it uses: get_template_part( $slug, $name ); // Include the single post content template get_template_part( ‘template-parts/content’, ‘single’ ); That means actualy for WP: Get a (partial) template for a (in this case) single post. … Read more