• I’ve created a home page that I want to use, And I have a custom loop running on the home page here:

    https://web.prioritiesbydesign.com/admin-assist/

    Everything is working fine except a few things.
    1) I want to allow to title of the posts to be <h4>
    2) I want the title to be a hyperlink to the article
    3) if possible to enable a mouseover.

    The code I have is:

    add_action(‘pagelines_inside_top_theloop’,’custom_loop’);

    function custom_loop(){

    if(is_front_page()):

    $myquery = new WP_Query(‘showposts=5’);

    while ($myquery->have_posts()) : $myquery->the_post();

    the_title();

    the_excerpt();

    endwhile;

    endif;

    }

    I’ve tried a few different things I’ve found on WP site on custom loops but I’m not enough of a programmer to know what’s working and what’s not.

    Thanks!

    Joel

Viewing 2 replies - 1 through 2 (of 2 total)
  • example:

    function custom_loop(){
    if(is_front_page()):
    $myquery = new WP_Query('showposts=5');
    while ($myquery->have_posts()) : $myquery->the_post();
    echo '<h4><a href="'; the_permalink(); echo '">'; the_title(); echo '</a></h4>';
    the_excerpt();
    endwhile;
    endif;
    }

    mouseover might be possible with css :hover styles.

    Thread Starter goforthculture

    (@goforthculture)

    YES YES YES YES YES!!!!!!!

    Thank you so much!! I’d buy you a beer if I could.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Simple Custom Loop on Home Page.’ is closed to new replies.