Support » Fixing WordPress » How to post categories inside of a page

  • Hi everyone,
    http://romancingthepast-lowery.com/

    Let me start by saying I am very new to wordpress and PHP. However, I have been writing HTML/CSS for awhile now, I am not totally clueless when it comes to having to mess with code. With that being said, I have been looking EVERYWHERE for this solution, and I can’t seem to find a solid answer. for exactly what I am looking for.

    Here is my goal:
    -Create Page called “Blog”
    -Create category called “Blog”
    -Each time I make a new post with “Blog” as it’s category, have that same post appear on the “Blog” page.

    Notes: I don’t mind if that post appears on the homepage as well (In face, that is ideal)

    Things I have tried so far:
    [Plugin] Inline Posts: What I didn’t like about this plug-in, was that I had to go and update the page each time I made a new post.

    [Plugin] Blog-In-Blog: This is the closest thing that I have found to what I want. The major issue I had with this plugin however, was that it included a profile picture that I didn’t know how to get rid of.

    [Plugin] Page2Cat: To be perfectly honest, I don’t know how to set it up. When I look for a solution for this problem, most people point to this Plugin. However, it looks like a lot of the support is gone for it, and gives little to no instruction as to how to install in.

    Thanks guys!

Viewing 13 replies - 1 through 13 (of 13 total)
  • Search “page of posts” here: http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates

    You’ll just have to use that code to create a template, then use that page template when you create your page called “blog” – not so bad after all!

    Thread Starter TobinShields

    (@tobinshields)

    Thanks for the quick reply! I am reading through that guide, and I guess I have just one quick question: where do I save my page template? I looked at my theme, and I don’t want to put it in the wrong spot.

    -Thanks!

    The template gets saved in yoursitename/wp-content/themes/themename

    It’s as simple as creating a php file, naming it as per that page
    <?php
    /*
    Template Name: Snarfer
    */
    ?>

    And there ya go!

    Thread Starter TobinShields

    (@tobinshields)

    Awesome! So I looked at the “Page of Posts” section, and I saved the .php file, and was able to see it when I made a new post. However, my next question is (and I know this is really basic) what would I change in that code to make it so “blog” was my selected category?

    Thanks for your help!

    Like that page says,

    A Page Template that displays posts from a specific category depending on a Custom Field assigned to a Page. In this example the value of the Custom Field “category” is retrieved and used as the category to retrieve the posts in that category. So if the category of posts you want to display is called “Events” then assign the Custom Field “category” with a value of “Events” to the Page.

    Thread Starter TobinShields

    (@tobinshields)

    Ah! Yes, I saw that. However, ‘Category’ appears quite often, and I wasn’t sure what to change.

    <?php
    if (is_page() ) {
    $category = get_post_meta($posts[0]->ID, ‘category’, true);
    }
    if ($category) {
    $cat = get_cat_ID($category);

    What ‘Category’ would I end up changing?

    Thanks again! I know I am asking very basic questions, but thanks for bearing with me.

    -Tobin

    I don’t believe you change the code – I think you assign the ccategory to the page via the Custom Code capability – so on the page itself, scroll down to “custom fields” (hint: if it’s not there, you’ve got to enable it by clicking on it in the “screen options” dropdown on the top of the page!)

    Yeah?

    Thread Starter TobinShields

    (@tobinshields)

    Okay, so you have helped A LOT. But just one tiny last thing.

    I am staring at the custom field, and I am not really sure what to put in. I put ‘blog’ as both the name and value, but on the actual site it gave me the error “Sorry, the page your requested could not be found, or no longer exists”. Quite disheartening.

    Help?

    Thanks,
    Tobin

    Quoting still .. I think you’ve almost got it:

    So if the category of posts you want to display is called “Blog” then assign the Custom Field “category” with a value of “Blog” to the Page.

    Watch your capitalization too … you never know

    Thread Starter TobinShields

    (@tobinshields)

    Ah! I got it! Thank you! I got this! This works amazingly! Thank you sir. This is going to make my life a lot easier.

    Pleasure to help you. I just realized that something I’ve been struggling with is perfectly solved by doing exactly what you’re doing 🙂

    I place my post incide a page with the plugin “Page Links To”

    Click on the HTML tab and then copy and past the below code

    <?php query_posts('cat=28'); ?>

    Also, install “PHP Execution” plugin

    The plugin will allow you to run the PHP.

    Hope you enjoy!

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘How to post categories inside of a page’ is closed to new replies.