YK
Forum Replies Created
-
As it is almost my first experience in PHP coding the result might appear not so elegant as it could be. But it works.
So I will reply to my post myself.
Not so much researching and reading The Codex led me to the following result:
<?php $args = array('parent' => XX, 'orderby' => 'ID', 'order' => 'desc'); $categories = get_categories( $args ); foreach ($categories as $category) { echo '<p><strong><a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "%s" ), $category->name ) . '" ' . '>' . $category->name.'</a></strong>'; if ( $cat_desc = $category->description ) echo '<br />'. $cat_desc .''; else echo ''; echo '<br />Posts in this subcategory: '. $category->count .''. $comments .''; foreach (get_posts('cat='.$category->term_id.'&order=asc&orderby=date&posts_per_page=1') as $post) { setup_postdata( $post ); echo '<br />'.get_the_date('j F Y').': <a href="'.get_permalink($post->ID).'">'.get_the_title().'</a>'; } echo '</p>'; // for the FIRST variant foreach (get_posts('cat='.$category->term_id.'&order=asc&orderby=date&posts_per_page=1') as $post) { setup_postdata( $post ); echo 'Active since '.get_the_date(); } foreach (get_posts('cat='.$category->term_id.'&order=desc&orderby=date&posts_per_page=1') as $post) { setup_postdata( $post ); echo ' till '.get_the_date(); } // and for the SECOND variant foreach (get_posts('cat='.$category->term_id.'&order=asc&orderby=date&posts_per_page=1') as $post) { setup_postdata( $post ); echo 'Years active: '.get_the_date(Y); } foreach (get_posts('cat='.$category->term_id.'&order=desc&orderby=date&posts_per_page=1') as $post) { setup_postdata( $post ); echo '-'.get_the_date(Y); } } ?>
You may also list some or all (by adding the number which is surely larger than maximum imaginable number of posts into appropriate variable) posts in each subcategory by including the following snippet:
foreach (get_posts('cat='.$category->term_id.'&order=desc&orderby=date&posts_per_page=1') as $post) { setup_postdata( $post ); echo '<br />'.get_the_date('j F Y').': <a href="'.get_permalink($post->ID).'">'.get_the_title().'</a>'; }
Mind the variables.
Forum: Plugins
In reply to: [Hot Responsive Slider] I see nothing but the shortcode itselfAs I’ve said earlier, WooCommerce is the only plugin installed at this time.
Both WooCommerce and WordPress have Russian localisation. Don’t think it matters, but just in case
Forum: Plugins
In reply to: [Hot Responsive Slider] I see nothing but the shortcode itselfMay its workability depend on PHP version? phpinfo says my host provider is running PHP 5.6.23
Forum: Plugins
In reply to: [Hot Responsive Slider] I see nothing but the shortcode itselfIf it would be of any help there is also latest WooCommerce up and running on my site. The theme is based on WARP framework, functions.php is empty.
Forum: Plugins
In reply to: [Hot Responsive Slider] I see nothing but the shortcode itselfMy site is heavily under construction now and password protected. I’m not sure it is a good idea to give anybody a link at the moment.
But anyway how could you detect an error if the only you would be able to see is aforesaid shortcode written in place where Hot Responsive Slider should normally slide photos? ??
Forum: Plugins
In reply to: [Hot Responsive Slider] I see nothing but the shortcode itself1. I’m sure )
2. Now it shows {slider}images/photos{/slider} instead of the slider itself
I’m afraid the shortcode has not been registered with my WP4.6 installation.
Forum: Plugins
In reply to: [Hot Responsive Slider] I see nothing but the shortcode itselfThe plugin is activated.
Ok, let you please just give me the correct shortcode for loading photos from
/photos
folder. As far as I understood from the instructions on the plugin settings page I should put {slider}path_to_the_photos_folder{/slider} shortcode where I want to see your slider. As neither/photos
norphotos
are working then I believe I do something wrong but can not figure out what exactly is wrong.