• Resolved vitaefit

    (@vitaefit)


    Hello,

    When I try to use footnotes on a category page but it’s doesn’t work. Maybe I have to do something else ?

    Best regards,

    • PHP 7.3.23
    • WordPress 5.5.1
    • GeneratePress theme

    PS : Thank you very much for this plugin ! It’s really help me in my article.

    • This topic was modified 4 years ago by vitaefit.

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

Viewing 15 replies - 1 through 15 (of 16 total)
  • Plugin Contributor pewgeuges

    (@pewgeuges)

    @vitaefit

    Thank you for reporting the issue with footnotes in excerpts, as used in category pages (and archive views). It’s one of the two remaining major bugs.

    The only valid solution is currently working around this limitation by not placing footnotes in the article’s first 55?words used by the blog engine to produce the excerpt.

    We are sorry for this limitation and the inconvenience it represents for Footnotes users.

    The principle of having footnotes in excerpts brings the alternative between positioning a reference container beneath each supported excerpt or at the bottom of the page, probably for all excerpts after renumbering the present footnotes for that purpose. I can hardly think of the latter as feasible, and the former seems doubtful too as the blog engine would probably need to be heavily extended so it can add custom content to excerpts.

    Personally I even think that the concept of category views and archive views is incompatible with the concept of footnotes. The related setting in the plugin doesn’t seem to work. IMO it doesn’t make much sense either, but I may be wrong.

    What the plugin must become capable of in any case is filtering out the footnotes text and delimiters so the blog engine gets enabled to deliver pure excerpts, skipping footnotes just like it does skip paragraph breaks.

    Would that meet your expectations and requirements?

    Thanks again for pinpointing this problem!

    Best regards.

    • This reply was modified 4 years ago by pewgeuges.
    • This reply was modified 4 years ago by pewgeuges.
    • This reply was modified 4 years ago by pewgeuges.
    • This reply was modified 4 years ago by pewgeuges.
    Plugin Contributor pewgeuges

    (@pewgeuges)

    @vitaefit

    All my apologies for missing the point. This is about custom category pages, and on the linked page you are having six footnotes and they’re not processed. On such custom category pages, many things seem to be broken, as reported by many commenters on https://pagely.com/blog/create-wordpress-custom-category-pages/

    We need to know the plugin you are using to create custom category pages. I understand that you wish to have specific articles on category pages rather than parent pages, for the upside of having posts tied to several categories, unlike a child page only having a single parent page.

    I don’t understand the intricacies of WordPress, nor why the blog engine does not natively allow to add content to those pages in a straightforward manner with fully functional page generation, involving the run all plugins, among which Footnotes. It’s sometimes still sort of a patchwork not thoroughly engineered, some defective product design making users run into issues such as this one.

    There seems to be a hook that Footnotes is missing out on. The the_content hook doesn’t seem to be functional in the content added to category pages, else the footnotes would be processed. It’s not a widget either. Hopefully the unknown hook possibly involved does come up, but I don’t even know if it barely exists.

    I’m saddened that you are having that trouble with pages deprived of the basics.

    Hopefully this new year will yield the solution. Stay safe!

    Plugin Contributor Pea Lutz

    (@misfist)

    @pewgeuges

    Personally I even think that the concept of category views and archive views is incompatible with the concept of footnotes. The related setting in the plugin doesn’t seem to work. IMO it doesn’t make much sense either, but I may be wrong.

    I agree that footnotes don’t seem to make sense on archive pages, but… it would appear that they are attempting to use them there, so I guess we’re wrong. ??

    In any case, based on the example page (https://vitaefit.fr/musculation-au-poids-du-corps/), it looks like the long text containing the footnotes is the category term description (term_description), not post content (the_content). The plugin isn’t set up to work with taxonomy terms, only for post content.

    Plugin Contributor pewgeuges

    (@pewgeuges)

    @misfist

    Thanks a lot for looking into this issue. Indeed I’ve realized that I was totally wrong.

    To make it happen I’ve just added support for the term_description hook the same way the_content is supported in the plugin:

    
    add_filter('term_description', array($this, "term_description"), $p_int_TheContentPriority);
    

    But PHP complains about call_user_func_array() expects parameter 1 to be a valid callback, class 'MCI_Footnotes_Task' does not have a method 'term_description' while pointing to wp-includes/class-wp-hook.php:289.

    I’ll try to do further tests in case I’m missing something. For sure we must get footnotes to work wherever they’re likely to be used.

    Already the excerpts have a solution: use the Advanced Excerpt plugin. Footnotes’ dashboard does provide this solution, that @nikelaos found and shared in https://www.ads-software.com/support/topic/jquery-comes-up-in-feed-content/#post-13110879

    Hopefully there will be a solution for category pages too.

    • This reply was modified 3 years, 10 months ago by pewgeuges.
    • This reply was modified 3 years, 10 months ago by pewgeuges.
    Plugin Contributor pewgeuges

    (@pewgeuges)

    Update:

    When using this instead:

    
    add_filter('term_description', array($this, "the_content"), $p_int_TheContentPriority);
    

    …then the referrers appear correctly, and tooltips are inserted, but WordPress (what else?) destroys the functionality by deleting the <?script?><?/script?> tags, causing the tooltip script to show up as plain text, and the onmouseover/onmouseout events are deleted too, disabling Footnotes’ alternative tooltips that could be used to fix it, although no AMP plugin is enabled. WordPress itself seems to be destroying JavaScript on category pages!

    Also the reference container does not appear, because it’s appended to the content, but this content is not handled as content by WordPress.

    Based on this, the straightforward solution—benefitting all plugins, not Footnotes alone—consists in debugging/redesigning the WordPress blog engine to correctly handle all pages as expected. That should make for a version?6, to be rolled out ASAP!

    • This reply was modified 3 years, 10 months ago by pewgeuges.
    • This reply was modified 3 years, 10 months ago by pewgeuges.
    • This reply was modified 3 years, 10 months ago by pewgeuges.
    Plugin Contributor pewgeuges

    (@pewgeuges)

    @vitaefit @misfist

    You might be able to solve the problem by doing it the other way around.

    As @misfist hinted, WordPress and Footnotes in it are unable to perform what you’re asking them to achieve.

    But while there seems to be no way to get content handled properly on a category page, there are ways to get all posts of a specific category listed—with their image—on a specific page of content. Perhaps it would be hard to get it to look exactly like what you are currently having, but functionally it would be identical with fully functional footnotes and reference container.

    I come from testing a solution using the List Category Posts plugin https://fr.www.ads-software.com/plugins/list-category-posts/

    The plugin uses a command-line style shortcode system fully documented on https://github.com/picandocodigo/List-Category-Posts/wiki — and may need some lines of Custom?CSS to get bullets removed and start padding zeroed. Then the list of posts has titles and featured images below. I don’t know how to get the titles below the images, nor how to get the tiles layout with a div flow adapting to the window width as you are having it on your website’s category pages.

    You would create one new page per category, titled by the category name, with parent-child relationships replicating your current category hierarchy. On each page you would add (or not) page content with footnotes, and a shortcode, e.g.:

    
    [catlist name="Musculation au poids du corps" thumbnail=yes thumbnail_size=full]
    
    

    The footnotes reference container would display below this list. To get it to display above, just add the [?[references]?] shortcode above the [catlist] shortcode.

    In the Custom?CSS of Footnotes or your theme, you would add this code:

    
    .lcp_catlist {
    	list-style-type: none;
    	padding: 0;
    }
    

    Beside that, sadly I don’t see any way to improve the Footnotes plugin so as to get WordPress to let it do its job on category pages. The only solution I’m currently able to figure out would require this non-trivial effort on your end, with a risk of disrupting the design. The ability to use fully fledged footnotes might be worth it.

    Else, in the presence of a small number of footnotes on category pages, you may consider leaving everything as-is and to manually hard-code those footnotes by placing them in a numbered list and adding referrers and backlinks with manually coded hard links to each other, that may lack a scroll offset because your website doesn’t use a fixed header. The disruption would be limited to footnotes.

    As highlighted above, it seems like the WordPress engine is set up to annihilate our efforts to get Footnotes to work on category pages. Already two types of tooltips are damaged by an algorithm that I don’t know where it resides nor how it can be disabled. Even with all plugins deactivated but Footnotes, WordPress suppresses the inline <?script?> tags added for the footnote tooltips on a category page with footnotes in its description, after support is added for the hook that @misfist found out about.

    This is the code added in class/task.php:308: add_filter('term_description', array($this, "the_content"), $p_int_TheContentPriority);

    WordPress seems to have a dark side that is tiresome and wasting our time.

    The only action left so far is to wish you good luck with it!

    • This reply was modified 3 years, 10 months ago by pewgeuges.
    • This reply was modified 3 years, 10 months ago by pewgeuges.
    • This reply was modified 3 years, 10 months ago by pewgeuges.
    • This reply was modified 3 years, 10 months ago by pewgeuges.
    • This reply was modified 3 years, 10 months ago by pewgeuges.
    Plugin Contributor Pea Lutz

    (@misfist)

    @pewgeuges

    While perhaps possible, I don’t think it makes sense to implement footnotes for taxonomy term descriptions. The use case seems extremely uncommon and not really what footnotes are intended for.

    I’d prefer to focus my efforts on fixing issues and/or making improvements that would benefit a greater number of users.

    Plugin Contributor pewgeuges

    (@pewgeuges)

    @misfist

    Thank you very much for advice. As we can see, WordPress even actively blocks Footnotes on these pages, even when luckily the extra hook is supported; only adding the reference container is not solved yet.

    If we knew how the script blocking is done, we could disable it as an overkill interventionism on WordPress’ side.

    If the rest of the implementation is so easy as adding this hook in a line of code, then I’d not see why the option shouldn’t be added for edge cases, since the linked page makes much sense, and the related design choice would certainly become very widespread, if only WordPress supported it!

    I can’t understand why the plugin https://www.pluginmirror.com/plugins/enhanced-category-pages/ isn’t on the www.ads-software.com platform. This URL seems even unresponsive, so we should check it out from https://github.com/wp-plugins/enhanced-category-pages. The rationale too, as written with much detail in https://pagely.com/blog/create-wordpress-custom-category-pages/ makes actual sense to me.

    But WordPress seems to battle against whatever WordPress users may add as an extra on those pages. I fail to understand why so.

    ???

    On the other hand, I see how right you are. One direly needed feature is the duality Notes — References. Currently, a second footnotes plugin must be used to obtain the first list, although the scheme is fairly common: Currently it is supported by MediaWiki, and in widespread use on Wikipedia. I’ve started trying to figure out how to implement it in Footnotes…

    Plugin Contributor Pea Lutz

    (@misfist)

    @pewgeuges

    If we knew how the script blocking is done, we could disable it as an overkill interventionism on WordPress’ side.

    For security, WP strips out certain tags from the term description, which is typically used as a short intro to a term archive (if at all). Again, this doesn’t seem like a use case that warrants removing the filters applied to the term description field.

    The easiest solution would be to use static pages to create a category listing page. This could be accomplished by doing the following:

    1. Create page, titled the same as Category
    2. Add the category term description content to the page
    3. Add shortcode block and use the footnotes shortcode[ [references] ]
    4. Add a post listing block that enables displaying posts for a specific category (i.e. Getwid Demo, that includes a post list block and a table of contents block)
    5. Save
    • This reply was modified 3 years, 10 months ago by Pea Lutz.
    • This reply was modified 3 years, 10 months ago by Pea Lutz.
    Plugin Contributor pewgeuges

    (@pewgeuges)

    @misfist

    Thanks for Getwid. Its category posts display block has grid layout and titles below featured images (not above), exactly the way it should be.

    As of the rest, things are not very clear to me. Today, Footnotes works perfectly—with tooltips and reference container at the end—in a category description. It took switching theme to GeneratePress. I thought it would be safe to run tests in Twenty Twenty-One, but it seems to be nothing else than that theme stripping off the script tags. GP leaves everything intact:

    https://ibb.co/gmjL8Gx
    https://ibb.co/r22qr5W

    From the description field, WordPress deletes even heading tags. I see no security concern behind that tyranny.

    @vitaefit cannot have a fully fledged article in that place without using some plugin. Here is a sample markup: <?p><?!?-- /wp:paragraph --?> <?!?-- wp:heading --?><??/p><??h2 Probably mixing it up doesn’t matter, but I wonder if Footnotes is impacted.

    Also for an article, best would be to insert it into the article element. For instance it’s in the header element of the page title.

    The problem may be due to a conflict with that plugin. While today, following various concerns, it needs to run at priority level?98, by the time this topic was opened, Footnotes ran at lowest priority, so probably the description content was there when Footnotes came on it.

    It’s also unclear why this category page doesn’t have category/ in its URL. The method you provide would imply deleting that page and create a new one instead with the [?[references]?] shortcode in a shortcode block (to avoid empty paragraphs before and after) followed by the block called “Recent Posts” but able to display up to 100?items (to be increased from the default 5?items). with “Display title” and “Display featured image” enabled, Layout: Grid; Columns: 2; Title Tag: Heading?3; and Image Size: Large (probably). The sorting order can be chosen too (chronological, alphabetical).

    But the solution requires remaking part of the website. I’d rather like to see Footnotes working as it does for me in the same theme (GeneratePress) in the same page type (category).

    Sorry for having made misleading statements based on incomplete tests. WordPress seems to be so unreliable we cannot be sure a given result will scale or transpose.

    There is also a concern with WordPress default links to categories. Would your solution need to add redirects? In .htaccess?

    Plugin Contributor pewgeuges

    (@pewgeuges)

    @vitaefit @misfist

    WooCommerce provides the code allowing a full article-like category description. With that in the child theme, publishers can paste the source code of articles and pages into the description text area. It seems there is no plugin needed. Certainly the cited plugin does likewise.

    Not supporting footnotes in category pages was thus a design flaw in the Footnotes plugin that is being corrected. We’ll just add this hook (correctly, not as when I started testing without defining the callback function first), then it works.

    @vitaefit, I apologize for the delay and lack of understanding. The fix is scheduled to be in v2.5.0 coming soon, hopefully next.

    Thanks to @misfist for the hook name.

    Plugin Contributor pewgeuges

    (@pewgeuges)

    @vitaefit

    The bugfix is in the now released 2.5.0. Footnotes now works in a category page in GeneratePress.

    Apologies again for the long delay, ended by this urgent bugfix plus feature (the template stack) release. The term_description hook is not in the dashboard yet, it’s just supported alongside the the_content hook and shares everything with it: callback function and priority level. That’s also kind of consistent, given in category pages, term_description is the hook used for the added content.

    @misfist Many thanks again for the hook name! Without your help I was stuck.

    Additionally, for those wondering how to get an article in a category page:

    1. Put the code below into your child theme’s functions.php.
    2. Create the article as new.
    3. Enter code view, copy all.
    4. Open the category editor in the dashboard.
    5. Paste the article source code in the description text area.
    6. Save.
    
    /**
     * Allow HTML in term (category, tag) descriptions
     * 
     * From WooCommerce
     * @see <https://docs.woocommerce.com/document/allow-html-in-term-category-tag-descriptions/>
     */
    foreach ( array( 'pre_term_description' ) as $filter ) {
    	remove_filter( $filter, 'wp_filter_kses' );
    	if ( ! current_user_can( 'unfiltered_html' ) ) {
    		add_filter( $filter, 'wp_filter_post_kses' );
    	}
    }
     
    foreach ( array( 'term_description' ) as $filter ) {
    	remove_filter( $filter, 'wp_kses_data' );
    }
    
    • This reply was modified 3 years, 10 months ago by pewgeuges.
    • This reply was modified 3 years, 10 months ago by pewgeuges.
    Plugin Contributor pewgeuges

    (@pewgeuges)

    I think the WordPress philosophy aims to always upgrade the blogging platform and make it a full CMS, never to enforce limitations. Therefore any user request is legitimate and must not be dismissed.

    In the case of category pages, WordPress had better applied the post/page scheme from the beginning on, and never create a term_description to delete HTML markup, images and more, leaving only a small subset related to inline formatting, hyperlinks. That’s why we need to fix WordPress, and the code below—posted again with edited/augmented comments—should be part of every theme, or better, implemented in WordPress natively. For now it’s delivered by WooCommerce and we need to spread it as a patch:

    
    /**
     * Allow all HTML elements in term (category, tag) descriptions
     * 
     * From WooCommerce
     * @see <https://docs.woocommerce.com/document/allow-html-in-term-category-tag-descriptions/>
     * 
     * By default, WordPress deletes heading tags, div tags, images
     * when saving a term description, leaving only such things as
     * inline formatting and hyperlinks.
     */
    // prevents WordPress from altering HTML in term descriptions:
    foreach ( array( 'pre_term_description' ) as $filter ) {
    	remove_filter( $filter, 'wp_filter_kses' );
    	if ( ! current_user_can( 'unfiltered_html' ) ) {
    		add_filter( $filter, 'wp_filter_post_kses' );
    	}
    }
    // does the same when the term description function is invoked:
    foreach ( array( 'term_description' ) as $filter ) {
    	remove_filter( $filter, 'wp_kses_data' );
    }
    
    • This reply was modified 3 years, 10 months ago by pewgeuges.
    Plugin Contributor pewgeuges

    (@pewgeuges)

    @misfist

    Your first advice I like most. It stands out as the only useful post amidst the nonsense I dumped before and after. You brought it to the point:

    I agree that footnotes don’t seem to make sense on archive pages, but… it would appear that they are attempting to use them there, so I guess we’re wrong. ??

    In any case, based on the example page (https://vitaefit.fr/musculation-au-poids-du-corps/), it looks like the long text containing the footnotes is the category term description (term_description), not post content (the_content). The plugin isn’t set up to work with taxonomy terms, only for post content.

    Indeed by default, only post_content and widget_text were enabled. The plugin had started supporting footnotes also in titles, as @nikelaos requested in https://www.ads-software.com/support/topic/more-feature-ideas/ but still doesn’t remove the footnotes in the other usages of the title in menus and title element, so it’s unusable.

    Very early, @aenniss requested Footnotes to work on custom post types other than those using the_content like WooCommerce product page custom post type does so that Footnotes works out of the box on product pages. As you can see there, a wrong solution was applied by adding the ability to process footnotes in the_post, not noticing that the post is altered before it’s loaded in the editor (or perhaps WordPress made that happen by modifying the blog engine later on). In v2.0.5 on November?2 I did even worse by enabling that hook by default (along with the_title and the rest), without proper testing, and without proper release!

    I was and still am not experienced enough (started really using WP less than a year ago) and was tasked only as a last resort after coming up with many bug fixes on GitHub after Footnotes’ unsuccessful call for developers.

    That’s why I now think that without me interfering on the Forum by making long-winded misleading statements, you will be a good maintainer of the Footnotes plugin.

    I just won’t take more responsibility than I’m already given, and leave any related decision making to our Plugin?Author and project manager.

    • This reply was modified 3 years, 10 months ago by pewgeuges.
    Plugin Contributor pewgeuges

    (@pewgeuges)

    @misfist

    Hi Pea,

    As you hinted, I think that the plugin must be set up for whatever footnotes are used in.

    For now, the term_description hook is just added as such, and it just works. Sadly the plugin isn’t updated on @vitaefit’s website yet.

    But if you see better ways to add support, please feel free to go ahead and release a bugfix or whatever.

    I’ll probably still try to commit if thankfully other fixes become available, but I think my role on the forum should be terminated because often I did a really bad job. Sorry please.

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Footnotes doesn’twork on category page’ is closed to new replies.