• Hi everyone

    Ive been using EE previously and due to some project now im onboard of yours trully wp. However it took me a while to identify the things i need but still im clueless on how to get them. (Ive been going through wps docs as well as searching with the help of the google to get what i think i need. But to tell you frankly, if you dont know the wp-slang and not a php coder – your going to have a bit of a problem.)

    To cut the long story short. I understand the templating system and created custom templates (and choosed them on the pages edit sections) for some of the pages.

    Now my question is for what you reffer as static front page. I designed a front page with different sections. So the content is rather divided in to different parts of the template. So i need to call specific category entries to specific locations on my template ( Like News category on side bar and category b related content in to the middle part.)

    in this page i found some codes and i kinda combined them to look like what i needed. which is

    <?php
    if ( is_indexpage() ) {
    	query_posts( 'cat=3' );
    // The Loop
    while ( have_posts() ) : the_post();
    	echo '<li>';
    	the_title();
    	echo '</li>';
    endwhile;
    
    // Reset Query
    wp_reset_query();
    }
    ?>

    But alas this code doesnt provide the means.

    Im sorry if these questions did came up before. Any type of help is welcome and much appreciated.

    God bless.

Viewing 5 replies - 1 through 5 (of 5 total)
  • this is_indexpage() might not work as it is not a generic wordpress function – are you trying to check for the posts page or front page?

    try is_home() or is_front_page()

    https://codex.www.ads-software.com/Conditional_Tags

    But alas this code doesnt provide the means.

    what exactly is and is not working?

    does the query and the loop produce posts of that category?

    a link to your site as it is now might help to illustrate your challenge.

    have you read https://codex.www.ads-software.com/The_Loop for examples of (multiple) loops?

    Thread Starter Aaron

    (@gardi)

    Actually just now i had a eureka moment.

    Ive removed the if conditions because “duhh” this is already the index page. Now i m working with this code

    <?php
    // The Query
    query_posts( 'cat=7');
    
    // The Loop
    while ( have_posts() ) : the_post();
    	echo '<li>';
    	echo '<a href="the_title();">';
    	the_title();
    	echo ' - ';
    	the_time('F jS, Y');
    	echo '</a>';
    	echo '</li>';
    endwhile;
    
    // Reset Query
    wp_reset_query();
    ?>

    The site is currently an beta and i cannot publicly write the link. Would you like me to send you a pm?

    apart from:
    echo '<a href="the_title();">';
    which should possibly be:

    echo '<a href="'.get_permalink($post->ID).'">';

    the code looks ok – assuming that there are ul tags somewhere…

    btw: the query can use all these parameters: https://codex.www.ads-software.com/Class_Reference/WP_Query#Parameters
    (some might need a different syntax)

    Thread Starter Aaron

    (@gardi)

    Alright we are on the right track. One last (tiny) question.

    echo '<a href="'.get_permalink($post->ID).'">';

    So this code provides the “http:/siteurl/post-id” kinda result.

    But since all my pages are currently built in a static page kinda way; i want to direct them to the pages link rather than a dinamic page.php

    Ive tried something like this but again failed miserably

    echo '<a href="'.get_permalink('xxx/'$post->ID).'">';

    PS : I know of the settings – permalink panel. But this panel is obviously built with dynamic templating in mind. (which is not a bad idea – however does not work with my situation)

    https://codex.www.ads-software.com/Function_Reference/get_permalink

    But since all my pages are currently built in a static page kinda way; i want to direct them to the pages link rather than a dinamic page.php

    you are dealing with posts in the loop, and ‘get_permalink()’ will create a link to the single post, usually displayed by single.php

    i am not sure where your pages come into this (?)

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘have different categories in different part of the page.’ is closed to new replies.