Support » Fixing WordPress » How to use pages over posts for snippets in a custom WodPress site

  • Resolved sixfootjames



    For a while now, I have been using posts to “pull” certain bits of content onto a home page or any other page. The problem with this is that if someone clicks on that link it will go to.
    instead of

    Until now, this is the code snippet I would use pull the post out of the db, but I would like to know if this is possible for pages too please.

    <?php query_posts('category_name=book-now-button&posts_per_page=1'); ?>
    <?php while (have_posts()) : the_post(); ?>
    <a class="book-now" href="<?php the_permalink() ?>">&nbsp;</a>
    <?php endwhile;?>

    Essentially, rather than any posts, I want to use only pages, so that WordPress works more like a general CMS than blog.

    Many thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • esmi


    Forum Moderator

    You can’t use any of the category parameters with Pages as Pages simply don’t have categories. Or tags. So you would need to look at another way of selecting specific Pages via query_posts etc.

    Thanks Esmi.

    I gave this some more thought.

    To keep it simple, I would still use the posts (for the news items) but in WP, I could create a subpage called “News-items” and make it submenu under “News”.

    In my Reading Settings (in WP), I could then tell the posts page to use the “News-Items” page.

    What should then happen according to my understanding, is that when someone clicks on a post from the home page, it should redirect to…

    Yet, this is not happening. Is there another configuration setting I might be missing?

    Many thanks



    Forum Moderator

    Post will have the permalink that you configured in Settings -> Permalinks. See Using_Permalinks.

    Thanks again Esmi.

    It seems this option is working for me then.


    This at least results in…

    Other pages just link as normal then. 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to use pages over posts for snippets in a custom WodPress site’ is closed to new replies.