Viewing 18 posts - 1 through 18 (of 18 total)
  • Author
    Posts
  • #1341713

    In the “Magazine element”, the posts from different categories are displayed. Some posts are in the same category.
    If I now display the contents via the table of contents, the posts in the same categories are of course also displayed several times in the table of contents.
    Can this be prevented somehow?

    #1341752

    Hey Fischpi,

    Thank you for the inquiry.

    We cannot find the TOC element or widget in the page. Are you using a different plugin for the TOC? Please provide a screenshot of the TOC element using imgur or dropbox so that we can check it properly.

    Best regards,
    Ismael

    #1341755

    I’m using the enfold widget toc and also alternatively “LuckyWP Table of Contents”. Both have the “Same problem”. See Screenshot in private content area

    #1341900

    Hi,

    Thank you for the info.

    In the Magazine element, there is an Offset Number settings in the Styling > Pagination section where you can disallow duplicate posts on the entire page. Please set it to the second option to remove the duplicate posts.

    Best regards,
    Ismael

    #1341953

    Hi Ismael,

    but your suggested setting does not change anything (see screenshot). Do you need login data to have a closer look?

    #1342119

    Hi,

    Yes, please post the login details in the private field so that we can check the settings. Did you try purging the cache after editing the magazine elements’ offset settings?

    Best regards,
    Ismael

    #1342241

    See attached

    #1342506

    Hi Fischpi,

    Thanks for providing us with admin access.
    It seems to be a bug with TOC when using magazine element when multiple categories are selected.
    We’ll report it to our devs.

    Best regards,
    Nikko

    #1343329

    Hi Nikko,

    any news from the devs?

    Dirk

    #1343386

    Hi,
    Thank you for your patience, unfortunately, the DEV Team explains that it is not possible to combine TOC and Magazine with two or more categories selected due to technical reasons.
    I tested this script on the page you linked to and it seems to remove the duplicate links from the TOC, you can try it and see if it helps.
    Try adding this code to the end of your child theme functions.php file in Appearance ▸ Editor:

    function remove_duplicate_toc_links() { ?>
        <script>
    (function($) {
    	setTimeout(function(){
    var linksHtml=[];
    $('.avia-toc-container a').each(function() {
        var html=$(this).html();
       if( $.inArray( html, linksHtml) >-1){
          $(this).remove()
       }else{
          linksHtml.push(html);
        }
    });
    },500);
    }(jQuery));
    </script>
        <?php
    }
    add_action('wp_footer', 'remove_duplicate_toc_links');

    Best regards,
    Mike

    #1343394

    Hi Mike,

    thanks a lot it’s working! Other question: Is it possible to Collapse/Expand the Enfold-TOC?

    Dirk

    #1343398

    Hi,
    Glad to hear, you can try this script to toggle the TOC, I wrote it for this one page so I’m not sure if you have others. Clicking on the title toggles and I included some css to show a green arrow up/down to let users know. On page load it’s toggled but this can be changed.
    Try adding this code to the end of your child theme functions.php file in Appearance ▸ Editor:

    function toggle_toc_container() { ?>
        <script>
    (function($){
        $('#avia_auto_toc-2 .avia-toc-container').hide();
        $('#avia_auto_toc-2 > h3.widgettitle').click(function(e){
        e.preventDefault();
        var $this = $('.avia-toc-container');
        $this.toggle();
        $("#avia_auto_toc-2 > h3.widgettitle").toggleClass( "up" );
    });
    })(jQuery);
    </script>
        <?php
    }
    add_action('wp_footer', 'toggle_toc_container');

    and this to your Quick CSS

    #avia_auto_toc-2 > h3.widgettitle:before {
      content: "\2BC6 ";
      color: #42a51e;
    }
    #avia_auto_toc-2 > h3.widgettitle.up:before {
      content: "\2BC5 ";
      color: #42a51e;
    }

    Best regards,
    Mike

    #1343460

    Hi Mike,

    thanks for CSS code but Collapse/Expand doesn’t work?

    Dirk

    #1343482

    Hi,
    I see that you forgot to also add the script above to your child theme functions.php, I did this for you, please check.

    Best regards,
    Mike

    #1343495

    Hi Mike,

    thanks. Its working. I have seen that you have added the page-id in the functions.php. What must be changed / added in the code if I want to output the toc on another page?

    Dirk

    #1343499

    Hi,
    If you want to use this for other pages I recommend adding a custom ID to the toc to replace to auto generated avia_auto_toc-2 ID then in the script and css replace the page ID and #avia_auto_toc-2 with the new ID.
    Or since this is added via the widget element to the pages you could try just removing the page ID from the script.

    Best regards,
    Mike

    #1343526

    Hi Mike,

    thanks. It’s working ;-)!

    Dirk

    #1343549

    Hi,
    Glad we were able to help, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.

    Best regards,
    Mike

Viewing 18 posts - 1 through 18 (of 18 total)
  • The topic ‘Double headings in the table of contents’ is closed to new replies.