How do I create a custom WordPress page?

I want my WordPress blog to have a page called music. On that page I will query the DB for posts with the category music and then change around the look and feel of the posts. So I can’t just put a link to /categories/music/ because I want to do custom work on the posts.

Should I put this code in a separate php file and link to it? I think I may lose access to all the nice WordPress API calls if I do that.

Read More

I was thinking about using a filter, but I am not sure which one to use. I was thinking something like the following except the_title has not been grabbed yet so I cannot check the title.

function show_music(){

    if( is_page() && the_title('','',false) == 'music' ){
        echo "got here";
    }
}
add_filter('pre_get_posts', 'show_portfolio');

How would you go about this?

Related posts

Leave a Reply

2 comments

  1. You need to put the below code in the file, and then put the file in the Theme folder. Then you can create a page using WordPress pages and select a page template with the name you put in this comment:

    /*
    Template Name: Something Goes Here
    */