Theme development: How to add CSS classes to menu items?

You can use the nav_menu_css_class filter which is applied to every menu item in the specified nav menu. add_filter(‘nav_menu_css_class’ , ‘special_nav_class’ , 10 , 2); function special_nav_class($classes, $item){ $classes[] = ‘your-custom-class’; return $classes; } More info: http://www.wpbeginner.com/wp-tutorials/add-a-custom-class-in-wordpress-menu-item-using-conditional-statements/

Removing “Powered by” footer using child theme PHP [closed]

As the function sparkling_footer_info() uses esc_html__() and this function runs the esc_html filter before outputting, you can intercept the output there. add_filter (‘esc_html’, ‘wpse_245817_esc_html’, 100, 2 ); function wpse_245817_esc_html( $safe_text, $text ) { if ( $safe_text == ‘Theme by %1$s Powered by %2$s’ ) { return ”; } return $safe_text; } Maybe you have to … Read more

WP_Query to get post on frontpage

If you’re trying to get a post with the id of 32, the parameter you would use is p, which is one of the Post & Page Parameters. tag_id is used for querying posts with a particular Tag ID. $args = array( ‘post_type’ => ‘post’, ‘p’ => 32 ); $fp_post = new WP_Query( $args ); … Read more