• Resolved mccdcp

    (@mccdcp)


    Thanks for making this plugin. Just 1 Question: on the WordPress page I want to present publications from my Zenodo community, if I add the shortcode [display-your-zenodo-community] to display the publications, does the shortcode allow keyword-based options to display subsets of publications.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter mccdcp

    (@mccdcp)

    For example, if the publications I’d like to display are tagged in zenodo with keywords such as: “analytics”, “methods”, “editorials” and I’d like to display subsets of publications according to keywords in different sections of a page or different pages on the website, would it be possible to query and limit the output of publications based on keywords as shown in examples below:
    [display-your-zenodo-community keyword=”analytics”] or
    [display-your-zenodo-community keyword=”editorials”] or
    [display-your-zenodo-community keyword=”analytics, methods”]

    The ability to specify keyword-based options on the shortcode would enable users of the plugin to display different subsets of publications at different locations of a page or on different pages. Hope this is possible or easy to implement. Either way, please kindly let me know if this would work or if/how I could easily edit certain files in the plugin to make this possible. Thanks.

    Plugin Author yoannspace

    (@yoannspace)

    Hi,

    Sorry I did not come back to you earlier… I just saw this message.
    It should be fairly easy, yes. As you probably know, you can set this in the general admin options.

    In order to have this done also in the shortcode itself, would be probably pretty simple.
    I will try to do this in the next weeks, but if you can’t wait, I think you should simply add a parameter to the display_zenodo_data function (let’s call it $attr, so: function display_zenodo_data( $attr ) { ... }) and use it like this (in here):

    
    if( is_array( $attr ) ) {
        //Of course you should add some specific checks here so it does not break or hurt your website
        $shortcode_specific_keyword = $attr['keyword'];
    }
    

    Then send this variable to the zp_retrieve_json function (in here), so you have to modify a bit the call and the function itself. And finally inside that zp_retrieve_json function, do something like (in here)

    
    if( $shortcode_specific_keyword ) {
        $extra_keyword = $shortcode_specific_keyword;
    } elseif( array_key_exists( 'extra_keyword', $display_your_zenodo_community_options ) ) {
        $extra_keyword = $display_your_zenodo_community_options['extra_keyword'];
    }
    

    That should be it, but I haven’t tested anything here…

    I hope it helps.

    Best,
    Yoann

    • This reply was modified 2 years, 11 months ago by yoannspace. Reason: typo
    • This reply was modified 2 years, 11 months ago by yoannspace. Reason: typo
    Thread Starter mccdcp

    (@mccdcp)

    Thanks a lot for your kind reply.

    To avoid breaking my site, I can wait for a couple of weeks for you to update the Plugin implementation to allow for specifying keyword-based options on the shortcode.

    Look forward to the plugin update, best regards.

    Plugin Author yoannspace

    (@yoannspace)

    Hi @mccdcp,

    A new version is online.

    It will allow you to use:
    [display-your-zenodo-community keyword=”analytics”] or similar.

    I haven’t added the multiple keywords as shown: [display-your-zenodo-community keyword=”analytics, methods”]. That could be part of a future update, but I wanted to be quick and allow you to use this new option. (The problem is not the code, but releasing a new version is often a pain in WordPress…)

    I hope you like it.

    Best,
    Yoann

    PS: If you would like to give me your website URLs where you use this plugin, I would be keen on showing different examples in the README, for other users. Only if you want of course.

    Thread Starter mccdcp

    (@mccdcp)

    Hi @yoannspace .. thanks very much for such a fast turnaround to create this initial iteration of the keyword-based subset-selection option in the shortcode. This will definitely give us a great start, I will try it next week.

    Looking forward to the next/future update allowing a shortcode with a subset-selection options combining more than 1 keyword [display-your-zenodo-community keyword=”analytics, methods”]. When both are completed, I think these updates will greatly boost the userbase of your Zenodo-Wordpress integration plugin over the coming year as I will promote this for use by a consortium of small/under-resourced universities in Africa that can leverage this to host their own archives with Zenodo and display their content for different departments or topics through WordPress.

    Once again, thanks a lot for making this plugin!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Does shortcode allow keyword-based options to display subsets of publications’ is closed to new replies.