• Thank you for creating such a wonderful WordPress plugin. I love Zotpress.
    I understand that using custom CSS I can customize the bibliography on my webpage. However, I would like to hide the abstract initially, and then when a visitor clicks on show abstract then it should be visible. For this purpose, I am trying to filter the content of the [zotpress] shortcode, however, a simple filter does not work. I tested the same code it does work on the other content on the same page.

    
    function za_zotpress_shortcode_filter($output, $tag, $atts, $m) {
    	if ($tag === 'zotpress') {
    		return str_replace("Abstract", "New Abstract", $output);
    	}
    }
    add_filter('do_shortcode_tag', 'za_zotpress_shortcode_filter', 10, 4);

    Thank you very much, any help will b highly appreciated!!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Mark

    (@codeispoetry)

    I think you could do the hiding and showing with CSS alone along the lines of this solution: https://dabblet.com/gist/1506530

    So you’d load all of the abstracts without filtering, then display:none with CSS, and use a toggle to set the display status. This would require no filtering at WordPress level.

    Thread Starter aabdinzainul

    (@aabdinzainul)

    Thanks for the reply, Mark. Thanks for the link to the CSS trick. If I understood it correctly then this way I will be able to show/hide all of the abstract simultaneous, not a particular one. I want to show a link (Show Abstract/Hide Abstract) for each of my publications in the bibliography. I like the plugin because it very powerful particularly at the backend it does a very nice job. However, at the front end, I am not satisfied so I wanted some tweak.

    Mark

    (@codeispoetry)

    No, it can also be at the level of abstract, as there is no limit to the amount of toggles you can have. E.g. the toggle could be a placeholder “Abstract”.

    I suppose folks more well-versed in Javascript could also fix it that way; it doesn’t need to be CSS. The main thing I’m saying is that it’s probably not a great idea to do it at the level of WordPress content filters, as they necessitate a new database query (and hence page load) every time a new abstract is needed; whereas loading them all at once and then manipulating their visibility is going to be faster, easier to cache, etc.

    • This reply was modified 5 years, 3 months ago by Mark.
Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Filtering and replacing content’ is closed to new replies.