• Resolved Anonymous User

    (@anonymized-10133093)


    Hello,

    I have TOC setup to display only on posts, and only using the widget, so ‘enable support: Posts (tick)’ and nothing ticked on ‘Auto Insert’

    It all works great UNTIL I search posts using the Widget, then the TOC appears and is full of links that are not even on the screen! Please see the screen shots (settings included)… help needed! THANKS

    (the site is in password protected staging, but I can make it public to fix this bug if you like 🙂

    (screen shots in zip file…)

    https://www.learndigitalaudio.com/wp-content/uploads/2017/12/toc-bug.zip

    • This topic was modified 6 years, 12 months ago by Anonymous User.
Viewing 11 replies - 1 through 11 (of 11 total)
  • Steven

    (@shazahm1hotmailcom)

    Can you install this plugin:

    https://wordpress.org/plugins/widget-options/

    And then configure the TOC widget to not display on the Search page.

    Does that correct the issue? Please let me know if it does that way I can add the feature to the TOC widget.

    Thread Starter Anonymous User

    (@anonymized-10133093)

    Thanks for getting back so promptly.

    That plugin does indeed do the job, but it is a bloated monstrosity :() It would be fantastic to get the functionality in your plugin. I don’t think I could install ‘widget-options’ on a production site, it’s like a giant advert with a million unwanted bloating options. Urrghh!

    ‘widget-options’ seems to also fix the problem that the widget TOC is appearing on the posts page (that lists the posts with excerpts). I would like it to only appear on the actual posts, not when they are being previewed on the posts page.

    Cheers!!

    Steven

    (@shazahm1hotmailcom)

    Which options specifically did you enable in “Widget Options”? Could you post a link to the a screenshot showing it?

    Thread Starter Anonymous User

    (@anonymized-10133093)

    I left everything at default apart from selecting that the table of contents widget should be hidden on the search. Here is the screenshot:

    https://www.learndigitalaudio.com/wp-content/uploads/2017/12/widget-options-widget.png

    Everything in post types and taxonomies is default, un-ticked. I did not touch any other settings.

    Steven

    (@shazahm1hotmailcom)

    Thanks! Looks like this would be pretty easy to add. I’m not sure any options need to be added to the widget as I can not see how it would be useful to display the widget in the search context.

    Are you comfortable making a minor PHP edit to test? If you are, open this file:

    ../wp-content/plugins/easy-table-of-contents/includes/class.widget-toc.php

    Add this line of code on line 138

    if ( is_404() || is_archive() || is_search() ) return;

    Save the file.

    Does it do what you need now?

    Thread Starter Anonymous User

    (@anonymized-10133093)

    That completely sorts out the search issue, nice one!

    I still have an unresolved problem that the posts page is getting a table of contents displaying nonsensical results. It probably best if I just give you the user and pass for the apache directory protection on the new site to show you what’s going on (it should be secure anyway).

    Look at the posts, they all work fantastically, but the actual posts page with all the previews of the posts should not have a TOC, and they all link to things that don’t exist.

    Very weirdly it does not seem to be happening on my older (out of date) localhost version, I have no idea why, I have looked at everything.

    (/web-development-tutorials is my posts page).

    https://www.elsewebdevelopment.com/web-development-tutorials/
    user: [redacted]
    password: [redacted]

    Mega thanks for looking at this!

    • This reply was modified 6 years, 11 months ago by bdbrown.

    @david1103 – I’ve removed your logon credentials. I am 100% sure you mean well but please never post user credentials on these forums.

    https://make.wordpress.org/support/handbook/forum-welcome/#the-bad-stuff

    You can contact the author on their own site and, once there, the discussion is between the two of you. However, it is not OK to enter or send site credentials on these forums. It’s a fine line, but one that we need to enforce. Thanks for your cooperation.

    Thread Starter Anonymous User

    (@anonymized-10133093)

    Ok @bdbrown, but they were not logon credentials, only the Apache directory password which is about to be removed anyway when the last few things were fixed on the site.

    @shazahm1 looks like I can’t share the dir password, but I don’t think it makes much difference. basically what I hope is possible is one more line of code that would look like:

    if ( is_404() || is_archive() || is_search() || IS POSTS PREVIEW PAGE() ) return;

    Steven

    (@shazahm1hotmailcom)

    @bdbrown

    Is that page the page set as the “Post page” on the WordPress Reading setting admin page? Or is a theme template page which happens to display the posts? If it is the former and not the latter, change the code to this:

    
    if ( is_404() || is_archive() || is_search() || ( ! is_front_page() && is_home() )  ) return;
    

    If I managed to actually get my AND/OR/NOT correct in the if statement, this should prevent it from displaying on the page set as the posts page.

    Let me know if it works.

    Thread Starter Anonymous User

    (@anonymized-10133093)

    It was “the page set as the “Post page” on the WordPress Reading setting”, and you did it!!! Success!!

    Thanks so much, your plugin now works great with the widget only 🙂

    I must say that I wasted hours trying to get ‘table-of-contents-plus’ working before I found your new vastly improved version.

    I left a note on github to tell people about your version, but if you could tell the original author to redirect people to your version it might save quite a few headaches.

    https://github.com/zedzedzed/table-of-contents-plus/issues

    THANKS AGAIN!

    Steven

    (@shazahm1hotmailcom)

    Great to hear that fix it right up. The changed has been rolled into the plugin so it’ll be in the next update. I’ll try to push it out this/next week.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘TOC appearing wrongly in Widget On Search’ is closed to new replies.