How to get a category in a list item class

The first issue I’m seeing is that you’re trying to use the_category as a class. This won’t work as this function is intended to output the links to the categories assigned to that post. So it’s putting the href inside your class. You can debug and see how it works by removing your li and … Read more

Compile two queries to one set of results?

That would be nice if you query all three post_types at the same time, using one query, and then manipulating it using php. Consider this query: $args = array( ‘post_type’ => array( ‘pt1’, ‘pt2’, ‘pt3’ ), ‘meta_key’ => BUMP!!!! ); You can not use an array of meta_keys. So, I think the only way is … Read more

Generate a tabbed submenu — from taxonomy term or submenu item — with sample content

I ended up solving this problem with Ubermenu. What I wanted to write was complex enough that it made more sense to get a tested, commercial plugin that had the features I need. MaxMegaMenu didn’t do tabbed content but Ubermenu does. I’m able to construct menus like this: Taxonomy1 [Tabs] [DynamicTerms] [Dynamic Posts] Taxonomy2 [Tabs] … Read more

Custom Taxonomy and tax_query Issue?

I think that the problem is right in your code, but it’s really easy to overlook. Let’s take a closer look at this part: <div class=”col-md-4″> <?php echo $category_name = $get_categories[$i]->name; ?> </div> <?php $args = array( ‘post_type’ => ‘team’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘Team_Category’, ‘field’ => ‘slug’, ‘terms’ => $category_name ) ) … Read more

Order terms inside a select dropdown

I was working on someone else WP installation so I can get the info of WP Database to show Products information in a side-page. I’ve noticed that they have a plugin installed (Taxonomy order) that always return the terms posts in the same orden. Sorry for the confusion!

How to count data records in wordpress which have same meta_value in wp_postmeta table?

<?php global $wpdb; $table_name = $wpdb->prefix . “postmeta”; $login_name = sanitize_user( $_POST[‘parent_id’] ); $prepare = $wpdb->prepare( “SELECT COUNT(*) FROM $table_name WHERE meta_value=”Purva” AND meta_key = ‘parent_id’ “, $login_name ); $myrows = $wpdb->get_results( $prepare ); echo ‘<pre>’ . print_r( $myrows, true ) . ‘</pre>’; ?> I tried this and get values but still something missing…

Adding a span when custom post type is updated

No, you’re right. This is the code that is responsible for ‘New’ span: <?php if (strtotime($post->post_date) > strtotime(‘-14 days’)): ?> <div class=”new-job-tag”><span>New</span></div> <?php endif; ?> The only problem with your modification is that there is no field called the_modified_date in WP_Post object. The proper name of that field is post_modified, so your code should look … Read more

Working Bootstrap Carousel Conversion to WP – Technical Questions

I had a similar situation recently, making a Bootstrap carousel dynamic. Here’s my functions.php code for that: //Images Slider function themename_slider_home_images_setup($wp_customize) { $wp_customize->add_section(‘home-slider-images’, array( ‘title’ => ‘Home Slider’, )); $wp_customize->add_setting(‘home-slider-first-image’); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, ‘home-slider-first-image’, array( ‘label’ => __( ‘First Image’, ‘theme_name’ ), ‘section’ => ‘home-slider-images’, ‘settings’ => ‘home-slider-first-image’ ) ) ); $wp_customize->add_setting(‘home-slider-second-image’); $wp_customize->add_control( new … Read more