• Resolved insiderzfr

    (@insiderzfr)


    Hi

    I would like to display series title and image in the content-single-podcast page.
    I read this solved topic : https://www.ads-software.com/support/topic/how-to-display-series-image/

    But when I use the code of the first step :
    $series = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );

    a var_dump() on $series returns bool(false)

    Therefore, I cannot call the series information in my podcast single page…

    I’m using a child theme based on the free cream-magazine template.

    Thanks to helping me…

    -ISZ

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter insiderzfr

    (@insiderzfr)

    It’s ok if I try that :

    
    $myslug = 'mypodcastserie';
    $series = get_term_by( 'slug', $myslug, 'series' );

    But now, $myslug must to be dynamic…
    How to have Series slug in a single podcast ?
    get_query_var( ‘term’ ) is always blank…

    Thanks for your help
    -ISZ

    Plugin Contributor Jonathan Bossenger

    (@psykro)

    Hello @insiderzfr

    Because you are wanting to return the series image on a single podcast page, you cannot use get_query_var( ‘term’ ). This would only work on a series archive page, where the series term is passed into the request.

    On a single podcast page, you need to get the current podcast(post) id, and then get the series attached to that podcast, to get the series image

    $all_series_array = get_the_terms( get_the_ID(), 'series' );

    This will return an array of all the series terms attached to the current podcast, and you can use that to select a single series, and then use the series image attachment code from the original support ticket you referenced.

    Thread Starter insiderzfr

    (@insiderzfr)

    Yes @psykro it works ! thanks ??

    With a little bootstrap, it’s sexy ??
    If someone is interesting… :

    		<?php
    			$serie = get_the_terms(get_the_ID(), 'series');
    			$series = $serie[0];
    			$attachement_id = get_term_meta( $series->term_id, 'podcast_series_image_settings', true );
    			$img_serie = wp_get_attachment_image_src($attachement_id);
    		?>
    		<div class="card">
    		  <div class="card-body">
    			<div class="media">
    			  <img src="<?php echo $img_serie[0];  ?>" class="img-fluid img-thumbnail mr-3 rounded" style="width:150px;height:150px;box-shadow: 1px 1px 10px #a9a9a9;" alt="Serie Pochette">
    			  <div class="media-body">
    				<button type="button" class="btn btn-warning float-right ml-3"><i class="fas fa-podcast"></i> Tous les &eacute;pisodes <span class="badge badge-pill badge-dark"><?php echo $series->count; ?></span></button>
    				<h3 class="mt-0"><?php echo strtoupper($series->name); ?></h3>
    				<?php echo nl2br($series->description); ?>
    			  </div>
    			</div>
    		  </div>
    		</div>

    So I alswo would like to customise the series page with this, but taxonomy.php doesn’t exist on my template, how can I find the good component ?

    Thanks
    -ISZ

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to display Series image and Series Title in my content-single-podcast page’ is closed to new replies.