- This topic has 3 replies, 2 voices, and was last updated 4 years, 6 months ago by
Elvin.
-
AuthorPosts
-
July 26, 2021 at 8:10 pm #1872219
Adam
Hi, I’m trying to add the buzzsprout player to my hero, in a generate_after_header hook. I used to do this with blurry powerpress and simple podcast player, where I could add a [spp-player] shortcode, and then configure the podcast through the powerpress plugin.
But for buzzsprout, I need to enter the episode number (it’s a shortcode like [buzzsprout episode=’8926847′ player=’true’]) – and I’m wondering if there is a way to create a variable in a post and save the number ‘8926847’, such that I could reference it in the element? Does that make sense?
Example –
https://peoplehelpingpeople.world/2021/07/22/david-aspinall-auticon/How this was previously –
https://peoplehelpingpeople.world/2021/07/08/dr-lynda-ulrich-of-ever-widening-circles/My element hook –
<?php <div class="adam-podcast-hero"> <div class="adam-podcast-hero-meta"> <h1 class="blog-page-title"><?php the_title(); ?></h1> <span class="blog-meta-date-display"><?php the_time(get_option('date_format')); ?></span> | <span class="blog-meta-author"><a href="/about"><?php the_author(); ?></a></span> | <!--span><--?php $EpisodeData = powerpress_get_enclosure_data(get_the_ID(), 'podcast'); echo $EpisodeData['duration'];?></span> | --> <a href="<?php the_permalink(); ?>/#comments"><?php $c_num = get_comments_number(); if ($c_num != 1){ echo "{$c_num} Comments"; } else { echo "{$c_num} Comment"; }?></a> <br/><br/><br/><br/> [spp-player] </div> </div>July 26, 2021 at 8:52 pm #1872238Elvin
StaffCustomer SupportHi there,
You’ll need a custom field associated with the post that takes the number.
You then fetch it to the shortcode using
get_field('field_slug_here',get_the_ID());Example:
do_shortcode('[buzzsprout episode="'.get_field('your_field_slug_here',get_the_ID());.'" player='true']');July 28, 2021 at 7:58 pm #1875181Adam
Thanks so much, Elvin – I’m new to making my own custom values… that worked great!
July 28, 2021 at 9:26 pm #1875220Elvin
StaffCustomer SupportLearning how to do it opens up so many possibilities. 🙂
Glad you got it to work. No problem. 😀
-
AuthorPosts
- You must be logged in to reply to this topic.