• I feel stupid. Iread the Linking_Posts_Pages_and_Categories but where can I find this:

    Pages
    To link to a Page, find the ID of the target Page on the Pages administration panel, and insert it in place of the ’42’ in this link:

    post title

    In which file is it or which remplate?

Viewing 15 replies - 1 through 15 (of 19 total)
  • To find the id of a page, log in to your blog’s admin area, click on the ‘manage’ tab at the top, then the ‘pages’ tab. This brings up a list of the pages you have created, with a column showing the id of each one. Note down these ids. The url of a given page should then be https://www.yoursite.com/?page_id=n where n is the id of the page you want to link to.

    If you want links to more than one of your pages, in the form of a list, you could use the wp_list_pages template tag.

    Thread Starter alentejo

    (@alentejo)

    Thanks, but where do I find the link that I have to change?

    IE: post title

    I know the link id′s of my pages but where do I find the url that I have to change in order that the link will go to the page?
    I can not find the template for that and if I download the index.php it is empty.

    Where do you want this link to be (e.g. the sidebar, the footer)? I should get your site up and running first, because the easiest way to edit the theme files is to sign into your blog’s dashboard.

    The ‘Post Title’ link you are posting has a format which you would use to call a post, not a page. If you’re not sure of the difference, look here.

    Thread Starter alentejo

    (@alentejo)

    Thanks, my site is up and running. https://www.alentejohome.com/blogs Point is that I want to post to pages instead of categories. I somehow have to let wordpress know that instead of posting to https://www.alentejohome.com/blogs/?cat=12 it should post to
    https://www.alentejohome.com/blogs/?page_id=87 But I can no where find where I can change this link. I want all my properties not in the blog itself but under pages/property and want to do that by rss feed upload.

    So you want your ‘Property’ page to show all posts in a certain category? If so, you’ll need to create a modified page template (you might call it property.php), with a loop to fetch only all posts in the category. Then select property as the page template to be associated with your ‘Property’ page, using the dropdown list at the right of the edit page screen.

    See section 7.3 in the ‘Pages’ document I linked to in my previous post for how to create a page template of your own.

    I’ve never used it, but perhaps the query_posts function would be useful, e.g. make the new page template the same as the default, but add a call to include only posts in a certain category, before the Loop starts. See here for how you might do this; there could be better ways.

    Thread Starter alentejo

    (@alentejo)

    Thanks, it is much clearer now. Don′t know for sure if I can manage but I′ll try.

    Thread Starter alentejo

    (@alentejo)

    Well, I′m obviously not a programmer lol. I made this template:

    <?php
    /*
    Template Name: Property
    */
    ?>
    <?php get_header(); ?>

    <div id=”content” class=”narrowcolumn”>

    query_posts($query_string . “&order=ASC”)

    <?php if (have_posts()) : ?>

    <div class=”navigation”>
    <div class=”alignleft”><?php posts_nav_link(”,”,’« Previous Entries’) ?></div>
    <div class=”alignright”><?php posts_nav_link(”,’Next Entries »’,”) ?></div>
    </div>

    <?php while (have_posts()) : the_post(); ?>

    <div class=”post”>
    <div class=”itemhead”>
    <h2 id=”post-<?php the_ID(); ?>”>” rel=”bookmark” title=”Permanent Link: <?php the_title(); ?>”><?php the_title(); ?></h2>

    <?php foreach((get_the_category()) as $cat) { if ($cat->cat_name == ’12’) { ?>
    <span class=”favorite”><img src=”<?php bloginfo(‘template_url’); ?>/images/favorite.png” alt=”Favorite Entry” /></span>
    <?php } } ?>
    <?php /* Support for noteworthy plugin */ if (function_exists(nw_noteworthyLink)) { ?><span class=”metalink”><?php nw_noteworthyLink($post->ID); ?></span><?php } ?>
    </div>
    <small><?php the_time(‘F jS, Y’) ?> <!– by <?php the_author() ?> –></small>

    <div class=”entry”>
    <?php the_content(‘Read the rest of this entry »’); ?>
    </div>

    <p class=”postmetadata”><?php the_category(‘, ‘) ?> | <?php edit_post_link(‘Edit’,”,’ |‘); ?> <?php comments_popup_link(‘No Comments »’, ‘1 Comment »’, ‘% Comments »’); ?></p>

    <!–
    <?php trackback_rdf(); ?>
    –>
    </div>

    <?php endwhile; ?>

    <div class=”navigation”>
    <div class=”alignleft”><?php posts_nav_link(”,”,’« Previous Entries’) ?></div>
    <div class=”alignright”><?php posts_nav_link(”,’Next Entries »’,”) ?></div>
    </div>

    <?php else : ?>

    <h2 class=”center”>Not Found</h2>
    <p class=”center”><?php _e(“Sorry, but you are looking for something that isn’t here.”); ?></p>
    <?php include (TEMPLATEPATH . “/searchform.php”); ?>

    <?php endif; ?>

    </div>

    <?php get_sidebar(); ?>

    <?php get_footer(); ?>

    But what do I have to do to make it get the property listings and place them under the page Property?

    Altering the parameters of query_posts (i.e. the bit in brackets immediately following) changes how it behaves. In your case, I think it should read

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

    where n is the id of the category you want displayed.

    Thread Starter alentejo

    (@alentejo)

    Thanks but it′s still posting on the homepage instead of the property page

    Thread Starter alentejo

    (@alentejo)

    Sorry, I got it right, had a setting wrong in my other program. So it uploads perfectly to the Property Page but how do I now prevent it from showing up at the homepage?

    Thanks you immensely so far.

    Do you mean it’s stillposting on the homepage as well? That’s a seperate issue; you need to alter index.php, create a static front page, etc., to change that.

    Thread Starter alentejo

    (@alentejo)

    No I do not want a static homepage. It′s just that property should not show up there, the rest of the categories should

    Well, now that you know how to control which categories show up on a page, try the same method on index.php.

    Thread Starter alentejo

    (@alentejo)

    ah okay will try, thanks

    Thread Starter alentejo

    (@alentejo)

    Just one question, Can I manually put in the post the homepage has to look for as in:
    <?php query_posts(‘cat=11’); ?>
    <?php query_posts(‘cat=13’); ?>
    <?php query_posts(‘cat=14’); ?>
    <?php query_posts(‘cat=15’); ?>
    etc.?
    Or can I put in something like:
    <?php do not query_posts(‘cat=23’); ?>

    Thanks in advance

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘To link to a Page, find the ID of the target Page’ is closed to new replies.