admin管理员组文章数量:1305101
I am building a WordPress website and on the homepage is a category of music genres. The site is created so that can listen to music beat of different genre then go ahead to buy the beat. I have created pages that match genres(hip hop, reggae, rnb, rap etc), however my problem is displaying the music content(ie the ones on the homepage) on their respective pages.
Like for example Hip hop, Afro beat etc has their own pages, so I want a situation where when users click on the navigation link for Afrobeat page it takes them to the page displaying all the music content that matches the genre Afrobeat, which is Fine Girl. I want to music content to display on the Afrobeat page with same styling as the ones in the image below
I used the Adavanced Custom Fields plugin's Text field to display the genre's title
Here is the code:
<span class="song_details">
<div>
<h4>SONG TITLE:</h4> <span><?php echo $fine_girl_track['song_title'];?></span>
</div>
<div>
<h4>GENRE:</h4> <span><?php echo $fine_girl_track['genre'];?> // This line is displaying the genre with the (echo $fine_girl_track['genre']) part displaying the text from the advanced custom fields genre text field
</div>
<div>
<h4>PRICE:</h4> <span><?php echo $fine_girl_track['price'];?>
</div>
</span>
<button class="button tour_button">
<a href="<?php echo $fine_girl_track['link'];?>"><?php echo $fine_girl_track['link_text'];?></a>
</button>
Below is an image of the music genres displaying on site:
Image of the site pages displaying navigation links:
I am building a WordPress website and on the homepage is a category of music genres. The site is created so that can listen to music beat of different genre then go ahead to buy the beat. I have created pages that match genres(hip hop, reggae, rnb, rap etc), however my problem is displaying the music content(ie the ones on the homepage) on their respective pages.
Like for example Hip hop, Afro beat etc has their own pages, so I want a situation where when users click on the navigation link for Afrobeat page it takes them to the page displaying all the music content that matches the genre Afrobeat, which is Fine Girl. I want to music content to display on the Afrobeat page with same styling as the ones in the image below
I used the Adavanced Custom Fields plugin's Text field to display the genre's title
Here is the code:
<span class="song_details">
<div>
<h4>SONG TITLE:</h4> <span><?php echo $fine_girl_track['song_title'];?></span>
</div>
<div>
<h4>GENRE:</h4> <span><?php echo $fine_girl_track['genre'];?> // This line is displaying the genre with the (echo $fine_girl_track['genre']) part displaying the text from the advanced custom fields genre text field
</div>
<div>
<h4>PRICE:</h4> <span><?php echo $fine_girl_track['price'];?>
</div>
</span>
<button class="button tour_button">
<a href="<?php echo $fine_girl_track['link'];?>"><?php echo $fine_girl_track['link_text'];?></a>
</button>
Below is an image of the music genres displaying on site:
Image of the site pages displaying navigation links:
Share Improve this question edited Jan 27, 2021 at 21:36 fuxia♦ 107k38 gold badges255 silver badges459 bronze badges asked Jan 27, 2021 at 19:59 Adekola OlawaleAdekola Olawale 111 bronze badge1 Answer
Reset to default 0If I'm understanding your approach correctly, you seem to have hard coded music items?
I'm suggesting that you create custom post type, which whould be Music. You should also add custom taxonomy for the post type Music.
After this you can add music items under Music post type and set music items' genres as taxonomy. When this is done, you can add category url to menu.
Creating custom post type and custom taxonomy will help you to maintain your music items.
版权声明:本文标题:advanced custom fields - How to display genre of music content from one page to another page in wordpress 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741798084a2398056.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论