Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)
  • Forum: Themes and Templates
    In reply to: Author list
    Thread Starter delitfrancais

    (@delitfrancais)

    I did’t know about the page template. Work perfectly.

    Thanks

    Thread Starter delitfrancais

    (@delitfrancais)

    I will try to change the setting to 5, actually it’s set to 1 because I want to see only one article on the main page, so I guess that I can add the post per page for index.php only.
    If I can not set it to one in the index, the other solution still work… even if it’s not the best.

    thanks for the advice.

    Thread Starter delitfrancais

    (@delitfrancais)

    is it that hard?

    Thread Starter delitfrancais

    (@delitfrancais)

    Note : id I add &cat=6 id did work to give the articles of the cat 6… so I would need to create category-1.php, category-2.php, … one for each category… but it should be possible to do something else.

    Thread Starter delitfrancais

    (@delitfrancais)

    Next “problem”

    We have a specific code for the page “index.php”. The code give the title and excerpt for each article published in the last issue (it’s a student paper website).
    What we actualy do is that we create a “summary” page that is displayed (it contain mostly nothing but metadata).

    I changed the page “single.php” in order to display the summary with the script of “single2.php” and all the other with “single1.php”, however, the code of “index.php”, if pasted in “single2.php” will still display the last issue and not the content of the “summary” we are looking at.

    The actual code is the following :

    <?php get_header(); ?>
    
    <?php global $post; $myposts = get_posts('numberposts=1&offset=0&category=6'); foreach($myposts as $post) : setup_postdata($post); $jouredition = get_the_time('j.m.Y'); ?>
    
    <p>Édition du  <?php the_time('j F Y') ?></p>
    
    <p>Éditorial</span><br />
    <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a><br />
    <?php the_excerpt(); ?></p>
    <?php endforeach; ?>
    
    <p>Société
    <?php global $post; $myposts = get_posts('category=5'); foreach($myposts as $post) : setup_postdata($post); $jourpub = get_the_time('j.m.Y'); ?>
    <?php if ($jourpub == $jouredition) : ?>
    <br />
    <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a><br />
    <?php the_excerpt(); ?></p>
    <?php endif; ?>
    <?php endforeach; ?>
    
    <?php get_footer(); ?>

    This code invoque the articles in the “Éditorial” and “Société” section, but not from the issue we are lookink for, but for the last published.

    Note, the is some french in it.
    Édition du = Edition of the (date)
    jouredition= day of edition
    jourpub = day of publication (I think)
    Éditorial and Société = Editorial and Society (these are some of the sections in the paper).

    You can ask questions if it’s not clear.

    Thread Starter delitfrancais

    (@delitfrancais)

    I did work, thanks.

    Thread Starter delitfrancais

    (@delitfrancais)

    I want to display the custum field in the single page. So, the code will go in “single.php”

    The code “get_post_meta” use tree parameters. 1. $post_id 2. $key 3. $single

    For example, I have 2 post with the metadata “author”
    The value of the key for post #1 is “Paul” and for post #2 “Edward”.

    If I add the line <?php echo get_post_meta(1, 'author', true); ?> in the file “single.php”, then, I will always get “Paul” as the author, because the cose is looking for the key author in the post #1.

    What I want is, if I look at the page 1, I got “Paul” and for the page 2, I got “Edward”. So, for “$post_id” I don’t want to put a number, but I want the function that is used in “get_post_custom_values”. The “Default” value for “$post_id is “Current post”. And… if I write “current post” instead of a number, it did not work…

    Is it more clear…?

Viewing 7 replies - 1 through 7 (of 7 total)