• This is a humble request for help, as I am stumped.

    https://www.ahy4life.com/update_20121008/

    The above is a testing site. I need to add additional categories but cannot seem to fathom precisely the proper code for a specific section on each page. An rtfm has been unsuccessful. I tried using query, also without success.
    For example, if I wish to display the title and then the content from a post from ‘events’, which is ID=4, in the code below:

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    
    <h2><center><?php the_title(); ?></center></h2>
    
    <!-- Display the Post's Content in a div box. -->
    
    <?php the_content(); ?>
    
    <?php endwhile; else: ?>
    <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
    <?php endif; ?>

    [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.]

    what is the proper code?

Viewing 2 replies - 1 through 2 (of 2 total)
  • That’s not a WordPress site.

    Thread Starter biggupp

    (@biggupp)

    OK, I am trying to set up query using the code below for

    <https://www.ahy4life.com/update_20121008/events.php&gt;

    for the category ‘new_event’ cat=5, but still not working.

    <?php
    $featuredPosts = new WP_Query();
    $featuredPosts->query('showposts=5&cat=5');
    while ($featuredPosts->have_posts()) : $featuredPosts->the_post(); ?>
    <h2><center><a>"><?php the_title(); ?></center></a></h2>
    
    <?php the_content(); ?>
    
    <?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.]

    What am I missing here?

    [No bumping. If it’s that urgent, consider hiring someone.]

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