• http://www.ahy4life.com/update_20121008/promos.php right column, center section

    How do I mod/replace the code below to pull an excerpt from a specific category so that the title populates the top and the excerpt populates the bottom as in <http://www.ahy4life.com/events.php&gt;?

    <?php
    $featuredPosts = new WP_Query();
    $featuredPosts->query('showposts=5&cat=8');
    while ($featuredPosts->have_posts()) : $featuredPosts->the_post(); ?>
    <h2><center><?php the_title(); ?></center></h2>
    
    <?php the_excerpt(); ?>
    
    <?php endwhile; ?>

    [Moderator Note: Please post code or markup snippets between backticks or use the code button. As it stands, your posted code may now have been permanently damaged/corrupted by the forum’s parser.]

Viewing 8 replies - 1 through 8 (of 8 total)
  • That code is already pulling 5 posts from the category with an id of 8.

    Thread Starter biggupp

    (@biggupp)

    Why, then, do I only see ‘Please visit later.” This is the code the site is using presently. Would mod’g this be a better way to go?

    [mod: please read the forum guidelines about marking code: http://codex.wordpress.org/Forum_Welcome#Posting_Code ]

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
            <h1><a href="promos.php"><font color="#FFFFFF">
              <?php if( in_category( '8' ) ) {
    			the_title();?>
            </font></a></h1>
            <div> <a href="promos.php">
              <?php the_excerpt();
    
    		} 
    
    		?>
              </a>
            </div>
            <?php endwhile; else: ?>
            <p>
              <?php _e('Sorry, please visit us later.'); ?>
            </p>
            <?php endif; ?>

    That depends upon what theme template file you are modifying.

    Thread Starter biggupp

    (@biggupp)

    The live site <http://www.ahy4life.com/events.php&gt; functions properly with only one category. Not sure how theme template plays a role at this point, but I it is “Twenty Eleven.”

    Do not edit the Twenty Eleven theme. It is the default WordPress theme and having access to an unedited version of the theme is vital when dealing with a range of site issues. First create a child theme for your changes. Or use a custom CSS plugin.

    Thread Starter biggupp

    (@biggupp)

    The live site functions properly, irrespective of the them on which it is based. The mod I am trying to make is based on the existing structure.

    I’m sorry but you’re unlikely to get any help around here to make edits to the default theme. There are very good reasons why that theme should never be edited.

    Thread Starter biggupp

    (@biggupp)

    Thank you

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Pull Excerpt from Specific Category’ is closed to new replies.