• You MUST read the Babiato Rules before making your first post otherwise you may get permanent warning points or a permanent Ban.

    Our resources on Babiato Forum are CLEAN and SAFE. So you can use them for development and testing purposes. If your are on Windows and have an antivirus that alerts you about a possible infection: Know it's a false positive because all scripts are double checked by our experts. We advise you to add Babiato to trusted sites/sources or disable your antivirus momentarily while downloading a resource. "Enjoy your presence on Babiato"

Can anyone help me with a code to show a chapter list button?

house3000

Member
May 1, 2020
25
1
8
Can anyone help me with a code to show a chapter list button?

I was using the Psyplay theme, but in the video panel when visualizing the chapters of any series, it shows the "previous" and "next" chapter buttons, but does not show a "chapter list" button.


1695431154455.png



I want to add a "Chapter List" button, which is heading towards the page that contains the chapters.


1695431238731.png



I am not a programmer, so I was testing chatgpt, but he could only give me this good code, which does not work completely well, that if it shows the button, but it takes me to the page where all the series are, it does not take me to the page where are the chapters of the respective series.


<?php if (is_single() && is_post_type('episodes')) { ?>
<a href="<?php echo home_url('/series/'); ?>" class="btn bp-btn-series" style="color: #fff000;">
<i class="fa fa-list"></i> <span><?php _e('View All Episodes', 'psythemes'); ?></span>
</a>
<?php } ?>



1695431594470.png



The url are of this type: https://urlexample/series/ahsoka/
and the code only directs me here https://urlexample/series/



Sorry, it must be something simple, but I do not know how to do it. 😅
 
try this

<?php if (is_single() && is_post_type('episodes')) { ?>
<a href="<?php echo home_url('/series/'); ?><?php the_title(); ?>" class="btn bp-btn-series" style="color: #fff000;">
<i class="fa fa-list"></i> <span><?php _e('View All Episodes', 'psythemes'); ?></span>
</a>
<?php } ?>
 
  • Like
Reactions: house3000
try this

<?php if (is_single() && is_post_type('episodes')) { ?>
<a href="<?php echo home_url('/series/'); ?><?php the_title(); ?>" class="btn bp-btn-series" style="color: #fff000;">
<i class="fa fa-list"></i> <span><?php _e('View All Episodes', 'psythemes'); ?></span>
</a>
<?php } ?>


Ah yes, I had also tried that of adding the title, but it didn't help me either.

What he does is that he adds the title of the chapters to the URL / series / and does not work

In the code you would have to add something like <a href="<?php echo home_url('/series/'); ?> + Title_serie

It's just an example, I'm not programmer 😅
 
Try this
<?php bloginfo('url'); ?>/series/<?php echo sanitize_title(episodios_get_meta('serie')); ?>


I have another question, but if you need to charge me for helping me, then go ahead.


Do you have the same theme?

When you are in the first chapter of any season, other than the first season, can you go back to the last chapter of the previous season?

Because even if I set it, that button redirects me to the first chapter of the previous season, it doesn't redirect me to the last chapter of the previous season.

For example, if I am in the first chapter of the second season of a series, when I click on back, it redirects me to chapter 1 of the first season, and it does not redirect me to chapter 10 (last chapter) of the first season.
 
The code that controls this option is in \pagination\ab0.php
echo episodios_get_meta('temporada')-1;
echo '-capitulo-';
echo '1';


And it always returns me to chapter 1 of the previous season, and does not return me to the last chapter of the previous season.

<?php
// This is the first episode of season.
// Este es el primer episodio de temporada.
echo '<a class="btn bp-btn-previous" href="'; bloginfo('url');
echo '/';
echo 'capitulo/';
echo sanitize_title(episodios_get_meta('serie'));
echo '-temporada-';
echo episodios_get_meta('temporada')-1;
echo '-capitulo-';
echo '1';

echo '/">';
echo '<i class="fa fa-backward"></i>';
echo '<span>'.__('Previous').'</span></a>';

echo '<a class="btn bp-btn-next" href="'; bloginfo('url');
echo '/';
echo 'capitulo/';
echo sanitize_title(episodios_get_meta('serie'));
echo '-temporada-';
echo episodios_get_meta('temporada');
echo '-capitulo-';
echo episodios_get_meta('episodio')+1;
echo '/">';
echo '<i class="fa fa-forward"></i>';
echo '<span>'.__('Next').'</span></a>';
?>
 
AdBlock Detected

We get it, advertisements are annoying!

However in order to keep our huge array of resources free of charge we need to generate income from ads so to use the site you will need to turn off your adblocker.

If you'd like to have an ad free experience you can become a Babiato Lover by donating as little as $5 per month. Click on the Donate menu tab for more info.

I've Disabled AdBlock