Support » Plugin: Easy Footnotes » Showing footnotes in REST API

  • Howdy!
    The footnotes don’t appear when fetching post content via the REST API. That’s an issue with my plugin Print My Blog which uses the WP REST API to fetch a printer-friendly version of the post (otherwise, the two plugins are a nice pair.)

    A user of my plugin reached via email (that’s their site being linked to). You can see the normal web-view of their page here: http://blog.ncmaps.org/index.php/ould-virginia/

    I can fix the problem by changing easy-footnotes.php on line 160 from

    
    if ( ( is_singular() || $efn_show_on_front ) && is_main_query() ) {
    

    to

    
    if ( (( is_singular() || $efn_show_on_front) && is_main_query()) || defined('REST_REQUEST') ) {
    

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

Viewing 1 replies (of 1 total)
  • I may have a workaround from my end. It would probably be better if you could fix it on your end, but I understand if you don’t have the resources or if it risks breaking other things. Here’s what my external fix looks like:

    
    add_filter( 'the_content', 'fix_easy_footnote_after_content_before', 19 );
    function fix_easy_footnote_after_content_before($content){
        global $wp_query, $pmb_wp_query_is_singular;
        $pmb_wp_query_is_singular = $wp_query->is_singular;
        $wp_query->is_singular = true;
        return $content;
    }
    add_filter( 'the_content', 'fix_easy_footnote_after_content_after', 21 );
    function fix_easy_footnote_after_content_after($content){
        global $wp_query, $pmb_wp_query_is_singular;
        $wp_query->is_singular = $pmb_wp_query_is_singular;
        return $content;
    }

    Hacky, I know.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.