[Support request] Changing location of recent posts in mobile view

Home Forums Support [Support request] Changing location of recent posts in mobile view

Home Forums Support Changing location of recent posts in mobile view

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #935350
    Devesh

    How can i change the layout for mobile view.
    For e.g. I want to make the comments box appear below the recent posts (since recent posts get pushed to the bottom of the post in the mobile view and not on the sidebar as in desktop view)

    #935735
    David
    Staff
    Customer Support

    Hi there,

    couple of ways to do this, one would require a child theme and editing of the single-post templates to change the comments form position…. tricky.

    The alternative is to install the Widget Shortcodes plugin:

    https://en-gb.wordpress.org/plugins/widget-shortcode/

    Then with the shortcode it generates for the related posts you can hook that in to position using a Hook Element:

    https://docs.generatepress.com/article/hooks-element-overview/

    1. Create a new Hook
    2. Add the following code:

    <div class="hide-on-desktop">
    // Add the shortcode here //
    </div>

    3. Select the before_comments_container hook
    4. Check the Execute Shortcodes checkbox
    5. Set the Display rules to Posts > All Posts
    6. Add this CSS to remove the Right Sidebar on mobile:

    @media (max-width:  768px) {
        #right-sidebar {
            display: none;
        }
    }
    #935948
    Devesh

    Cool solution….it worked.
    Just wanted to know adding this plugin and hook…..i hope it does not reduce the site speed?

    #935952
    David
    Staff
    Customer Support

    Awesome 🙂 Saved rewriting templates…

    It shouldn’t make any noticeable difference using a single shortcode to display the content.

    #936083
    Devesh

    Many Thanks!

    #936087
    David
    Staff
    Customer Support

    You’re welcome

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.