Display WordPress Search

Tom, You’re right! I didn’t know how templates function, this was not something major, I just wanted to get that value and then display that value on my single.php page – but now I see that’s not how WordPress works. I decided to just leave off that functionality 🙂 Thanks, Josh

Automated mark posts as featured every day

OK, so first of all you’ll need to add your own WP_Schedule event: add_action( ‘wp’, function () { if (! wp_next_scheduled ( ‘mark_posts_as_featured_event’ )) { wp_schedule_event(time(), ‘daily’, ‘mark_posts_as_featured_event’); } } ); function mark_posts_as_featured_event_callback() { // if there are sticky posts in our CPT, unstick them $sticked_post_ids = get_option( ‘sticky_posts’ ); if ( ! empty ) … Read more

Remove tag on my RSS Feed

I believe the most direct way of customizing WordPress feeds is to hook into them directly with the following filter. Edit: as we talked about, let’s just edit the content to tear out any function edit_your_feed_content($content) { $content = preg_replace(“/(<figure.*?[^>]*>)(.*?)(<\/figure>)/i”, “”, $content); return $content; } add_filter(‘the_content’, ‘edit_your_feed_content’);

Displaying Saved Meta Box Data in Drop Down with selected()

<?php selected() ?> compares the value of the stored data and which option should appear first, my error was that I wasn’t storing the variable to compare it to correctly. $selected = isset( $values[‘location’] ) ? esc_attr( $values[‘location’][0] ) : ”; should be changed to: $selected = isset( $custom[‘location’] ) ? esc_attr( $custom[‘location’][0] ) : … Read more

Two different menus for two different locations?

You most probably used the theme location part wrongly. Here is an example of how it should be done Follow the comments in code for explanation 🙂 add_filter( ‘wp_nav_menu_args’, function ( $args ) { if ( is_page( 2 ) //Only target page 2 && $args[‘theme_location’] === ‘primary’ ) { // Check and only target the … Read more