content - Custom slugs for Each Tab

I have a website for musicians information. The information is divided to few different subjects, using tabs - 'Gen

I have a website for musicians information. The information is divided to few different subjects, using tabs - 'General', 'Songs', 'Albums' and 'Videos.

<?php if($tab_story){?>
<li role="presentation" class="active">
    <a href="#story" aria-controls="story" role="tab" data-toggle="tab">Information</a>
</li>
<?php } ?>
<?php if($tab_album && !empty($check_album)){?>
    <li role="presentation">
        <a href="#album" aria-controls="album" role="tab" data-toggle="tab">Albums</a>
    </li>
<?php } ?>
<?php if($tab_video && !empty($check_video)){?>
    <li role="presentation">
        <a href="#video" aria-controls="video" role="tab" data-toggle="tab">Videos</a>
    </li>
<?php } ?>
<?php if($tab_song && !empty($check_song)){?>
    <li role="presentation">
        <a href="#song" aria-controls="song" role="tab" data-toggle="tab">Songs</a>
    </li>
<?php } ?>

I want to replace the code here, as well as in WordPress in general so when I click on any of the tabs I would be redirected to new URL with a related slug. For example, clicking on the 'Songs' tab would do:

  • /
  • /

I have tried using add_rewrite_endpoint() and add_rewrite_rule(), but after serval good tries I couldn't get the result I'm looking for. 'endpoint' is more likely what I need, as I don't have any tags or search options on the page which is needed for the 'rule' function. But with endpoint function, I create new slugs for the entire site, including post_types which doesn't require these extensions.

Example to a site with a similar concept:

Thanks!

I have a website for musicians information. The information is divided to few different subjects, using tabs - 'General', 'Songs', 'Albums' and 'Videos.

<?php if($tab_story){?>
<li role="presentation" class="active">
    <a href="#story" aria-controls="story" role="tab" data-toggle="tab">Information</a>
</li>
<?php } ?>
<?php if($tab_album && !empty($check_album)){?>
    <li role="presentation">
        <a href="#album" aria-controls="album" role="tab" data-toggle="tab">Albums</a>
    </li>
<?php } ?>
<?php if($tab_video && !empty($check_video)){?>
    <li role="presentation">
        <a href="#video" aria-controls="video" role="tab" data-toggle="tab">Videos</a>
    </li>
<?php } ?>
<?php if($tab_song && !empty($check_song)){?>
    <li role="presentation">
        <a href="#song" aria-controls="song" role="tab" data-toggle="tab">Songs</a>
    </li>
<?php } ?>

I want to replace the code here, as well as in WordPress in general so when I click on any of the tabs I would be redirected to new URL with a related slug. For example, clicking on the 'Songs' tab would do:

  • https://example/artist/name/
  • https://example/artist/name/songs/

I have tried using add_rewrite_endpoint() and add_rewrite_rule(), but after serval good tries I couldn't get the result I'm looking for. 'endpoint' is more likely what I need, as I don't have any tags or search options on the page which is needed for the 'rule' function. But with endpoint function, I create new slugs for the entire site, including post_types which doesn't require these extensions.

Example to a site with a similar concept: https://www.allmovie/movie/godzilla-king-of-the-monsters-v599127

Thanks!

Share Improve this question asked Jun 9, 2019 at 15:52 GuestExchangeGuestExchange 1
Add a comment  | 

1 Answer 1

Reset to default 0

Probably some javascript that's capturing the click which you will need to find and turn off, changing the anchor tags href to your links once the js has been fixed should make the tabs go to the correct page rather then opening a normal tab and work like allmovie.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745421855a4627000.html

相关推荐

  • content - Custom slugs for Each Tab

    I have a website for musicians information. The information is divided to few different subjects, using tabs - 'Gen

    5小时前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信