Is there any need to use both wp_reset_postdata and wp_reset_query together?

There’s no need to use them both. You should only use wp_reset_query(), if you modified query with query_posts() (which you should avoid). This function also call wp_reset_postdata() – http://core.trac.wordpress.org/browser/tags/3.4.1/wp-includes/query.php#L95 So it’s better to use wp_reset_postdata() after running separate query.

First post of each category

It’s not possible to get one posts per category with one simple query, and even a complex query will take more time than 3 separate query. So, if you want simplest, then this is the solution – $cats = array(‘lifestyle’, ‘fashion’, ‘beauty’); $exclude_posts = array(); foreach( $cats as $cat ) { // build query argument … Read more

How to remove menus section from WordPress theme customizer

Try nav_menus instead of menus with remove_panel() function mytheme_customize_register( $wp_customize ) { //All our sections, settings, and controls will be added here $wp_customize->remove_section( ‘title_tagline’); $wp_customize->remove_section( ‘colors’); $wp_customize->remove_section( ‘header_image’); $wp_customize->remove_section( ‘background_image’); $wp_customize->remove_panel( ‘nav_menus’); $wp_customize->remove_section( ‘static_front_page’); $wp_customize->remove_section( ‘custom_css’); } add_action( ‘customize_register’, ‘mytheme_customize_register’,50 ); Hope this will helps you. Thank you!

How to display category specific post content on a page

Codex Just take a look at the WordPress Template Hierarchy. Templates You’ll find out that WordPress has three different types of templates, that you can use: A) For built in taxonomies: Category & Tag B) For custom taxonomies. The template engine will search for such templates when you request a category/tag/custom taxonomy archive page. taxonomy-{$taxonomy_slug}-{$term}.php … Read more

Extend walker – navigation, adding data attribute to a tag

This is how I added data attribute to my menu It simply adds data-title=”menu-title” to each link on my main nav, change it to adapt to your need. You don’t actually need to use Nav Walker to add this add_filter( ‘nav_menu_link_attributes’, ‘cfw_add_data_atts_to_nav’, 10, 4 ); function cfw_add_data_atts_to_nav( $atts, $item, $args ) { $atts[‘data-title’] = $item->post_title; … Read more