WordPress 3.5 how to determine if user is on category listing or category edit screen?
if(is_admin() && isset($_GET[‘taxonomy’]) && $_GET[‘taxonomy’] == ‘category’ && isset($_GET[‘tag_ID’]) { // place your code here }
if(is_admin() && isset($_GET[‘taxonomy’]) && $_GET[‘taxonomy’] == ‘category’ && isset($_GET[‘tag_ID’]) { // place your code here }
Now try this, surely it will work query_posts(“cat=1, 2&showposts=5&post_type=item”); while(have_posts()) : the_post(); echo $title = get_the_title(); echo $content = get_the_content(); endwhile;
Use the following codes in the page.php file or in the home page template if you have created any. Use Child theme to edit your theme files if( is_home() || is_front_page() ) { $args = array( ‘posts_per_page’ => -1, // To show all the posts ‘cat’ => cat_id // Replace cat_id with the actual category … Read more
Code is here: WordPress chained categories I write the same code for categories. You can edit for your needs. I used the that js plugin: http://www.appelsiini.net/projects/chained
use it for comment number <?php comments_number( ‘no responses’, ‘one response’, ‘% responses’ ); ?>
I have used ACF – Advanced Custom Fields for this multiple times ( http://www.advancedcustomfields.com/resources/how-to-get-values-from-a-taxonomy-term/ ). The problem with taxonomy images & other custom fields is that the values are stored in wp_options table. In bigger sites this will populate the wp_options table a lot and is probably not the most efficient way to store data. … Read more
You can use the following line of code in your category.php file for Random posts. <ul> <?php $posts = get_posts(‘orderby=rand&numberposts=5’); foreach($posts as $post) { ?> <li><a href=”https://wordpress.stackexchange.com/questions/169519/<?php the_permalink(); ?>” title=”<?php the_title(); ?>”><?php the_title(); ?></a> </li> <?php } ?> </ul> </li>
I used this plugin and it does the job. Now I can design my category pages from my admin backend using my page builder.
If you create your own shortcode based on the product category shortcode function duck_product_categories( $atts ) { global $woocommerce_loop; $atts = shortcode_atts( array( ‘number’ => null, ‘orderby’ => ‘name’, ‘order’ => ‘ASC’, ‘columns’ => ‘4’, ‘hide_empty’ => 1, ‘parent’ => ”, ‘ids’ => ” ), $atts ); if ( isset( $atts[‘ids’] ) ) { $ids … Read more
Use echo get_cat_name( $cat ); instead of the_category() inside the link. the_category() returns a link, so you will have a link within a link.