• Resolved giofilo

    (@giofilo)


    Hi,

    After many attempts, I still haven’t been able to make that the posts uploaded by him don’t have the default template of the Twenty Twenty theme, but a custom one.

    If you click on the “Older Posts” button, you can clearly see what I mean: https://www.usualillusion.com/category/one-song-a-day/

    Here’s what I did:

    1) I created a child theme of Twenty Twenty
    2) In the child theme, I created a file category-a-song-a-day.php, to use as template of that category
    3) in that file, there is this piece of code:

    
    <div class="ig-grid" id="ig-grid-infinite">
      <?php if ( have_posts() ) {
        mytheme_infinite_scroll_loop();
      }?>
    </div>
    

    4) in functions.php (of the child theme) there is:

    
    function mytheme_infinite_scroll_loop(){
      while ( have_posts() ) {
        the_post();
        get_template_part( 'content-ig');
      }
    }
    
    function mytheme_infinite_scroll_init() {
     add_theme_support( 'infinite-scroll', array(
       'type'           => 'click',
       'footer_widgets' => true,
       'container'      => 'ig-grid-infinite',
       'wrapper'        => false,
       'render'         => 'mytheme_infinite_scroll_loop',
     ) );
    }
    add_action( 'after_setup_theme', 'mytheme_infinite_scroll_init' );
    

    5) finally, the file content-ig.php is:

    
    <div <?php post_class(); ?> id="post-<?php the_ID(); ?>">
    
      <div class="ig-entry-content">
    
        <a href="<?php the_permalink(); ?>">
          <?php the_post_thumbnail('medium_large') ?>
        </a>
    
      </div><!-- .entry-content -->
    
    </div><!-- .post -->
    

    Thanks to anyone who can help me.

    • This topic was modified 5 years, 1 month ago by giofilo.
    • This topic was modified 5 years, 1 month ago by giofilo.

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support darnelldibbles

    (@darnelldibbles)

    Hi there,

    I am receiving a Page Not Found message when I visit the link you provided. Did you make an update to the page?

    Thread Starter giofilo

    (@giofilo)

    I’m sorry @darnelldibbles, now the link should work. I changed the category slug, so I set a redirect 301 from the original one to https://www.usualillusion.com/?cat=1 and renamed the file category-one-song-a-day.php tocategory-1.php.

    • This reply was modified 5 years ago by giofilo.
    Plugin Support darnelldibbles

    (@darnelldibbles)

    Hi there,

    To be clear, you want to add infinite scroll to the site as opposed to having to click the older posts button?

    If so, this is outside of the scope of support that we provide. There are have been requests for this feature, but it does not look like we are going to move forward with adding it at this time:

    https://github.com/Automattic/jetpack/issues/13511

    I recommend contacting a place like Upwork and see if a freelancer could assist you with adding this to your site: https://www.upwork.com/

    Thanks,

    Thread Starter giofilo

    (@giofilo)

    Hi @darnelldibbles ,

    I like the older post button ??
    What I can’t do is to make those older posts look the same as the first 12 posts.

    When I click the older posts button, the default post template is loaded. Instead I want to use my custom template.

    Thank you for your help.

    Plugin Support darnelldibbles

    (@darnelldibbles)

    Ah, gotcha. Yeah, that is outside the scope of support we provide. I would definitely recommend reaching out to a place such as Upwork for assistance with something like this. Hopefully, this can get sorted for you.

    Thanks,

    Thread Starter giofilo

    (@giofilo)

    Ok @darnelldibbles, thank you anyway.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Infinite scroll and render option’ is closed to new replies.