• Hi Guys… I am a (non-web technology) coder and a wordpress beginner.

    I am planning to host my own website with Songs and their lyrics. Eventually want to monetize it through ad-hosting.

    I have gathered around 3.5 thousand of songs lyrics and their meta-data. I want to put them on my website but do not want to create 3.5k pages manually. I see some plugins like Multiple Page Generator which seem to enable the same. However, I wanted to know if there are other native/better options.

    Eventually when I will host ads on those, I do not want to manually configure each of those pages.

    Can someone please guide me to any “core functionalities”/”good plugins” that would help me do that in a best possible way?

    My sincere apologies if this question is too basic to ask.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    What you want is a custom template that is used for all of the lyric pages. The page content is generated dynamically based on requested parameters in the URL. You really only add one page based on the template. Its code will deliver unique content based on the information that was requested. Lets say you request example.info/lyrics/led-zeppelin/stairway-to-heaven/. The page that is served is “lyrics”, the band and song are parameters the template code uses to fetch the appropriate data from the database and serve it to the browser.

    You only have the one “lyrics” page, but it can dynamically generate nearly infinite possible sets of lyrics, limited only by your DB capacity.

    Thread Starter akshateic

    (@akshateic)

    @bcworkz Thank you for the response.
    I do get the methodology to achieve it. However, while going through my WordPress Admin interface, I am unable to understand which specific functionality to use to get this going.

    Can you please help in that?

    Moderator bcworkz

    (@bcworkz)

    The admin interface is only going to help you after you’ve done the necessary coding work. If you are using a distributed theme that is subject to occasional updates, like those from the plugin repository on this site, it’s strongly recommended that you create a child theme to contain your custom template. Otherwise updates will wipe out your custom work.

    Your template could begin with a copy of your theme’s page.php if it has one, otherwise index.php might work. The main reason to start with a copy is so the theme’s styling is applied to your custom content. If that’s undesirable, you could start anew with an empty .php file if you wanted to. Name the file in accordance with template hierarchy.

    Your code to fetch a song’s lyrics and display them needs to get the desired song from the super global $_GET, which means a request URL needs to be in the form example.info/lyrics/?song=stairway-to-heaven&artist=led-zeppelin. I recommend starting with that format to start with, but eventually you will likely want the more SEO friendly URL which I used as an example in my last reply. To get WP to recognize such an URL structure but still have your code be able to get parameters from $_GET, you need a custom rewrite rule to transform the SEO friendly URL to one that works for $_GET. To add such a rule, use add_rewrite_rule().

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Create multiple pages without manually creating them’ is closed to new replies.