Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1153477

    waterbarry
    Participant

    Hi,

    I’ve got a post listing shortcode that shows the latest posts.

    The Previous/Next buttons work, except for if the page is set as the homepage.

    Is there something I can remove from the index.php to change this.

    Here’s the code:

    <?php
    /**
     
     * @var int $paged
     */
    $paged = get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1;
     
    /** @var WP_Query $the_query */
    $the_query = new WP_Query( 'posts_per_page=8&cat=&paged=' . $paged );
     
    if ( $the_query->have_posts() ) :
     
        // The Loop
            echo '<div id="main_thing">';
        echo '<ul style="width:100%; margin-left: 0px;">';
        while ( $the_query->have_posts() ) : $the_query->the_post();
    	$derp = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), true, '' );
    	 
    echo '<li class="otherfeatures x-column x-sm x-1-4">';
    echo '<a class="notstyle" style="display:block;" href="';
    echo the_permalink();
    echo '">';
    echo '<div class="center_me"><h2>';
    echo the_title();
    echo '</h2></div>';
    $thumb_id = get_post_thumbnail_id();
    $thumb_url = wp_get_attachment_image_src($thumb_id,'thumbnail-size', true);
    echo '<div class="featuredseo" style="background:';
    echo 'url(\'';
    echo $thumb_url[0];
    echo '\');">';
    echo '</div>';
    echo '</a>';
     endwhile;
     echo '</ul>';
     echo '</div>';
     echo '</div>';
        // get_next_posts_link() usage with max_num_pages.
        echo '<div id="navster">';
    	echo '<div id="more">';
        echo get_next_posts_link( __( 'Older Entries »', 'textdomain' ), $the_query->max_num_pages );
    	echo '</div>';
    	echo '<div id="back">';
        echo get_previous_posts_link( __( '« Newer Entries', 'textdomain' ) );
    	echo '</div>';
    	  echo '</div>';
        // Clean up after our custom query.
        wp_reset_postdata();
     
    endif; ?>
    #1153479

    waterbarry
    Participant
    This reply has been marked as private.
    #1153559

    Christian
    Moderator

    Hey there,

    Regretfully, this particular customization request is outside the scope of our support as this is not related to an issue with the theme and instead has to do with your customization of it. As such, you will need to investigate this particular issue on your own or seek help from a developer should you not feel comfortable making these changes yourself. If you have any further questions about the theme, we are more than happy to provide you with assistance on these inquiries.

    Thank you for your understanding.

    #1154754

    waterbarry
    Participant

    Could you minimally tell me if I’m looking in the right place to edit how setting a page as Front Page affects it?

    #1154831

    Christian
    Moderator

    We’re sorry but investigating issues with custom code is outside the scope of our support. You might want to contact our trusted partners who caters X setup and customization needs. Please see https://community.theme.co/custom-development/

    Thank you for understanding.

    #1154856

    waterbarry
    Participant

    Grand cheers,

    I’ve tried several different functions that people have written to display latest posts with pagination.

    All work unless the page is set as the front page.

    If anyone had any suggests it’d be greatly appreciated.

    I’ll look into hiring someone to fix this hen the time comes.

    #1154957

    Christian
    Moderator

    Thank you.