• Resolved goldmember

    (@goldmember)


    i have included the get_posts php at the bottom of this page: https://www.diveneycue.com/wordpress/. however, for some reason its just showing the H2s but not the posts beneath them. any idea why its not showing the posts?

    <hr />
    <h2>New Diveney Cues</h2>
    <?php get_posts('category=29&numberposts=5&orderby=post_date'); ?>
    <br />
    <hr />
    <h2>New Trade In Arrivals</h2>
    <?php get_posts('category=30&numberposts=5&orderby=post_date'); ?>
    <br />

    please advise. thanks.

Viewing 10 replies - 16 through 25 (of 25 total)
  • Thread Starter goldmember

    (@goldmember)

    i got it working now with this code:

    <?php $recent = new WP_Query("cat=29&showposts=3"); while($recent->have_posts()) : $recent->the_post();?>
    <a href="<?php the_permalink() ?>">
    <?php the_title(); ?>
    <?php the_excerpt(); ?></a>
    
    <?php endwhile; ?>

    i had used it on another site. i think i had to first install the Exec-PHP plugin, which i just did. not sure but its working now.

    thanks for the help!

    Thread Starter goldmember

    (@goldmember)

    although, i’d like to know how i hide the descriptions from showing up? i just want the post titles to show. please advise. thanks!

    Get rid of this line if you only want the titles.

    <?php the_excerpt(); ?>

    Thread Starter goldmember

    (@goldmember)

    well that removes the description, however the titles then get bunched up on one line: see the “New Diveney Cues” section in the middle of this page https://www.diveneycue.com/wordpress/

    i’d like to avoid that but i dont see where in the css i would put in a clear (which i think is what i have to do.

    please advise. thanks.

    So put a line break in it’s place..

    <br />

    ??

    Thread Starter goldmember

    (@goldmember)

    a line break where? somewhere within this code below? to be clear, i want each posting to appear above the previous one so it looks something like this:

    Diveney Cues
    Cue 1
    Cue 2
    Cue 3

    Right now it appears like this:

    Diveney Cues
    Cue 1 Cue 2 Cue 3

    <?php $recent = new WP_Query("cat=29&showposts=3"); while($recent->have_posts()) : $recent->the_post();?>
    <a href="<?php the_permalink() ?>">
    <?php the_title(); ?>
    <?php the_excerpt(); ?></a>
    
    <?php endwhile; ?>

    This line..

    <?php the_excerpt(); ?></a>

    ..becomes…

    </a><br />

    Thread Starter goldmember

    (@goldmember)

    thanks. that worked!

    on a somewhat related note, how come when i edit the content of this page (which includes php code) and remain on the HTML tab, and hit Publish or Update, everything appears correctly. But for some reason, if switch over to the VISUAL tab, after I have updated my code and content, and then hit Publish or Update, I get some some garbled code when i look at my site???

    The editor is not really intended as a tool to be used in a switching fashion, you should use either Visual or HTML, not both..

    I’m by no means a bleeding edge coding guru, but in my personal opinion it’s pretty much an impossibility to expect a mode switching functionality from the editor that won’t break…

    By all means if someone can prove me wrong, i’d happily rejoice for all the WP users out there, but i’d personally consider it asking for the impossible…

    Thread Starter goldmember

    (@goldmember)

    not the answer i was hoping for but an answer nonetheless. thank you.

Viewing 10 replies - 16 through 25 (of 25 total)
  • The topic ‘get_posts php code not working’ is closed to new replies.