techeese
Forum Replies Created
-
its attached to hello world posts which is the wordpress 1st posts. which is still under uncategorized. the category i set this code is 3 which is called ‘song reviews’
well its not getting the first image of the post because I haven’t set any instead its getting my first upload in my wordpress media library.
https://i57.tinypic.com/kcdwnt.pngcode output of no featured post set
<li> <a href="https://indiecore/2015/06/18/song-review-alpha-betas-newest-single-title/" class="topp-img-container"> <img src="https://indiecore/wp-content/uploads/2015/06/cgdrawing-e1434519307675-320x175.png" alt="" title="" width="150" height="150" class="tptn_thumb topp-img img-responsive tptn_firstchild"></a> <span class="topp-title"> <a href="https://indiecore/2015/06/18/song-review-alpha-betas-newest-single-title/">song review alpha beta’s: newest single title</a> </span> </li>
I have set a different placeholder image in your top10 settings
hi,
showing of featured images yes But those without featured images doesn’t use the default placeholder thumbnail instead it fetches my first upload in my media library..
middle one in this pic is has a featured image set up while the rest isnt.
https://i57.tinypic.com/snfd04.pngright now it can fetch featured image but for posts related to the category without a featured image its fetching the a featured image from the very first post which is in a different category..
here the current code:function tptn_shortcode_songreviews( $atts, $content = null ) { if ( function_exists( 'get_tptn_pop_posts' ) ) { $list =''; $settings = array( 'daily' => TRUE, 'daily_range' => 7, 'limit' => 3, 'strict_limit' => FALSE, ); $topposts = get_tptn_pop_posts( $settings ); // Array of posts $topposts = wp_list_pluck( $topposts, 'postnumber' ); $args = array( 'post__in' => $topposts, 'orderby' => 'post__in', 'post_type' => 'post', 'cat' => '5', 'posts_per_page' => '3', ); $my_query = new WP_Query( $args ); if ( $my_query->have_posts() ) { $list = '<ul class="top-pick">'; while ( $my_query->have_posts() ) { $my_query->the_post(); $list = $list. '<li><a href="' . get_permalink( get_the_ID() ) . '" class="topp-img-container">'; $list = $list. tptn_get_the_post_thumbnail( array( 'postid' => get_the_id, //'thumb_height' => '45', //'thumb_width' => '45', 'thumb_meta' => $thumb_meta, 'thumb_html' => $thumb_html, 'thumb_default' => $thumb_default, 'thumb_default_show' => $thumb_default_show, 'scan_images' => $scan_images, 'class' => "tptn_thumb topp-img img-responsive", ) ); //thumbnail $list = $list.'</a>'; $list = $list. '<span class="topp-title"><a href="' . get_permalink( get_the_ID() ) . '">' . get_the_title() . '</a></span></li>'; wp_reset_postdata(); } $list = $list . '</ul>'; } else { echo "no top picks yet"; } wp_reset_query(); return $list; } } add_shortcode( 'tptn_list_songreviews', 'tptn_shortcode_songreviews' );
—————
as for the numbering currently using css counters so that i can style it moreI manage to get it working, it seems to be a cache problem deactivating plugin and hard refresh just wasn’t enough, so I tried to used the resets buttons under ‘reset count and other tools’ also turned off cache fix under ‘general’ although i don’t think this should cause any issues since i haven’t activated any cache plugins.
other notes:
-used browsers to test are set to save tab sessions and histories
-developing this in a local server NOT on a hosted serverhere’s a fresh reset with plugin reactivated and reset the counts
https://i62.tinypic.com/2vjrb5f.pngquirks: above it default will say No top posts yet, while the reseted the custom one doesn’t display the custom message i added in the
else { echo "something went wrong"; }
it will later once the default top10 gets its first view it will display the message.
——————————-2 things left I need to know and do now is how to add numbering after the title to the default as mentioned in my last post and another is to add thumbnail to the custom one
I dont see any its just blank, see screenshot plugin disabled:
https://i62.tinypic.com/33aq8lk.jpgas you can see trending section is using your given settings, while below is the code provided by op RobertMueller shows nothing..
this(from psd) is what I’m trying to achieve for the 2 top10 sidebars almost done with sidebar 1 just need to add a ordered number and sidebar 2 is well, still stuck
https://i57.tinypic.com/n71bb4.png2 sidebars of the top 10 plugin
bump
seems close to what I need although category post needs to be shown is 3 popular posts
while using the default top10 post. so 2 top10, 1 default and 1 like the op
i tried doing some editsfunction tptn_shortcode_songreviews( $atts, $content = null ) { if ( function_exists( 'get_tptn_pop_posts' ) ) { $list =''; $settings = array( 'daily' => TRUE, 'daily_range' => 7, 'limit' => 2, 'strict_limit' => FALSE, ); $topposts = get_tptn_pop_posts( $settings ); // Array of posts $topposts = wp_list_pluck( $topposts, 'postnumber' ); $args = array( 'post__in' => $topposts, 'orderby' => 'post__in', 'post_type' => 'post', 'cat' => '5', 'posts_per_page' => '3', ); $my_query = new WP_Query( $args ); if ( $my_query->have_posts() ) { $list = '<ul>'; while ( $my_query->have_posts() ) { $my_query->the_post(); $list = $list . '<li><a href="' . get_permalink( get_the_ID() ) . '">' . get_the_title() . '</a></li>'; wp_reset_postdata(); } $list = $list . '</ul>'; } else { echo "something went wrong"; } wp_reset_query(); return $list; } } add_shortcode( 'tptn_list_songreviews', 'tptn_shortcode_songreviews' );
although shortcode doesnt seem to show the output..
`<?php echo do_shortcode(‘[tptn_list_songreviews]’); ?> ‘