• Resolved yaniv1983

    (@yaniv1983)


    Hi, and thanks for your hard work!

    I am trying to create a show page, that will query the episodes sorted by the ssp publish date (not the WP post date).

    Is there a way to do that? Or any other solution that will prevent the editors from typing the date twice on every post update?

    Here’s my code so far (not designed yet ?? ).

    <?php get_header();?>
    <main id="site-content" role="main">
    <?php if( $series = get_the_terms( $episode_id, 'series' ) ){ ?>
    <h1 class="episodeName"><a href="https://podcast.radiosol.co.il/series/<?php echo $series[0]->slug; ?>"><?php echo $series[0]->name; ?></a></h1>
    <?php echo $series[0]->description; ?>
    
    <?php 
    
            $show_date = isset($instance['show_date']) ? $instance['show_date'] : false;
    
    		$query_args = ssp_episodes($number, $series[0]->slug, true, 'widget');
    		
    		$qry = new WP_Query( apply_filters('ssp_widget_recent_episodes_args', $query_args));
    
    ?>
    		<ul>
    		<?php while ( $qry->have_posts() ) : $qry->the_post(); ?>
    			<li>
    				<a href="<?php the_permalink(); ?>"><?php get_the_title() ? the_title() : the_ID(); ?></a>
    			<?php if ( $show_date ) : ?>
    				<span class="post-date"><?php echo get_the_date(); ?></span>
    			<?php endif; ?>
    			</li>
    		<?php endwhile; ?>
    		</ul>
    
    </main><!-- #site-content -->
    <?php } ?>
    <?php get_footer(); ?>
    

    Thanks!
    Yaniv

    The page I need help with: [log in to see the link]

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Contributor Jonathan Bossenger

    (@psykro)

    Hi @yaniv1983

    The plugin makes use of Custom Post types to manage Podcasts which uses the same post_date field as a regular WP Post, so you should be able to use the same field.

    https://developer.www.ads-software.com/reference/classes/wp_query/#order-orderby-parameters

    Thread Starter yaniv1983

    (@yaniv1983)

    Hi Jonathan, thanks for your answer! Can you please explain me a little more what should I change in code to get the items ordered by podcast publish date?

    Do I need to change that line?

    $query_args = ssp_episodes($number, $series[0]->slug, true, 'widget');
    

    Also, how can I change number of posts? In case I want it to be unlimited?

    Thanks!

    Thread Starter yaniv1983

    (@yaniv1983)

    Bump ?? Sorry if I am disturbing.

    Plugin Contributor Jonathan Bossenger

    (@psykro)

    Hi @yaniv1983

    If you read through the code for the ssp_episodes function, you will see it sets up the same query arguments as used by the WP_Query object, detailed in the documentation I shared with you here: https://developer.www.ads-software.com/reference/classes/wp_query/. So you will need to modify the $query_args array of arguments to include ordering by post date, and returning all items.

    This type of question is moving into the area of you using the support channels for our plugin in order to get me to develop your code for free. It might be worthwhile to search for some articles on how to set up and use WP_Query arguments.

    Thread Starter yaniv1983

    (@yaniv1983)

    I never asked you to develop the code for me. I asked for a simple solution that should be in your documentation. PHP codes for podcast title, picture, descrition, date, etc…

    I work with WP for more than 10 years. Your documentation simply is not providing the BASIC details for me to get the BASIC result done and print a nice podcast page. No tutorials, no sample pages, nothing.

    And then, this reply after 2 months of waiting.

    Plugin Contributor Jonathan Bossenger

    (@psykro)

    @yaniv1983 I have given you this documentation, it was in my first reply.

    Seriously Simple Podcasting uses the default WordPress Custom Post Type system.

    All podcast episodes are stored as posts in the WordPress posts table, just with a custom post type of podcast.

    So the reason we don’t have any specific documentation for this is that you can use all the default functionality available to WordPress posts, for querying podcasts.

    Your original question was this:

    I am trying to create a show page, that will query the episodes sorted by the ssp publish date (not the WP post date).

    The SSP publish date is the same the WP post date, the plugin makes use of all the same functionality.

    You then asked me about this code

    $query_args = ssp_episodes($number, $series[0]->slug, true, 'widget');

    As I pointed out that code will return an array of query arguments, which can be used to create a new WP_Query, based on the arguments.

    I’ve listed the links to the WordPress docs, that explains how WP_Query works, and how to use all the various arguments available.

    https://developer.www.ads-software.com/reference/classes/wp_query/

    This is all the documentation you need, to be able to add the orderby arguments to the query_args returned from that function, to add ordering by the date, and to also return all results.

    Thread Starter yaniv1983

    (@yaniv1983)

    If it was that simple, I would have not wasting my and your time for a solution. Post date and podcast date are different, and if the content editor uploads podcasts in random order, even if he adds the publish date in the SSP field, it sorts by the WP publish date.

    Plugin Contributor Jonathan Bossenger

    (@psykro)

    @yaniv1983 can I ask you to please upload a screenshot of what you see as the difference between post date and publish date?

    In a default install of SSP there is no separate publish date for a podcast episode, only the Date recorded field in the podcast custom fields.

    Thread Starter yaniv1983

    (@yaniv1983)

    Hi, it’s Hebrew translated, but I am sure you know both fields. Number (1) is the one being filled by the content editors. Number (2) is automatically generated by WordPress, and the one that sets the actual order in the archive pages.

    Screenshot: https://imgur.com/jBnzBq6

    The radio manager asked me to order posts by the (1) field. I just couldn’t find the way to do that.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Querying podcasts by publish date’ is closed to new replies.