WordPress.org

Ready to get started?Download WordPress

Forums

Page-list
Question - Page-list Plugin Customization (12 posts)

  1. new_B
    Member
    Posted 1 year ago #

    Hi,

    Thank you for the great plugin.

    I noticed that the FAQ mentions the following:

    "What to do if you need to change the plugin's code?

    When you changed the plugin's code you should also change the plugin's version to '100' (for example) to avoid updates, which could override and delete your code."

    => Is there any method (or any plans) to make functions overrideable in our theme's functions.php file? I found http://webdesign.anmari.com/2572/how-to-give-your-plugin-pluggable-functions/ which I assume means that the ability to override a plugin's function is dependent on how it was created.

    In particular, I would like to add modify some of the page list item output (add new classes, etc.)

    Thanks.

    http://wordpress.org/extend/plugins/page-list/

  2. webvitaly
    Member
    Plugin Author

    Posted 1 year ago #

    Thank you very much for your feedback.

    I will check it and I need to test it if it works without problems.

  3. new_B
    Member
    Posted 1 year ago #

    Thanks, webvitaly.

    Would it be possible to add hooks to the plugin? That way, it can be modified at certain areas (via filters and actions).

  4. new_B
    Member
    Posted 1 year ago #

  5. new_B
    Member
    Posted 1 year ago #

    Hi,

    I read further and it looks like page-list already has pluggable functions and thus, the latter of hooks and filters will not work. Sorry for the confusion

    if ( !function_exists('pagelist_unqprfx_parse_content') ) {

    Thanks again.

  6. webvitaly
    Member
    Plugin Author

    Posted 1 year ago #

    @new_B: Thank you for your advices and feedbacks.
    If you will test pluggable functions in real project and if you will use your own function instead of the Pagelist plugin's function please share your experience.
    If it will not work we can together think how to fix it.

  7. new_B
    Member
    Posted 1 year ago #

    Thanks, webvitaly.

    I tried overriding pagelist_unqprfx_shortcode in my theme's functions.php but had no luck. The plugin function seems to get loaded first, before the customized one in the theme.

    I searched around and it looks like pluggable functions is an older method and the preference is to use hooks (actions and filters) http://wpcandy.com/teaches/custom-hooks-and-pluggable-functions/. Can anybody validate this?

    If so, @webvitaly, would it be possible to add (filter and/or action) hooks to the plugin instead?

    What I need to accomplish is to modify the output in lines 71, 132 and 197 of page-list.php. (i.e., add/remove classes, etc.)

    Thanks.

  8. webvitaly
    Member
    Plugin Author

    Posted 1 year ago #

    You can add css classes via shortcode param:

    [pagelist class="custom-class custom-class-2"]

    Does this solve your problem?

  9. new_B
    Member
    Posted 1 year ago #

    Thanks, webvitaly--getting close it's a better and simpler solution.

    My goal is to upgrade the plugin to the current version and redo some hacks applied by the original developers who modified it. I can't reapply those changes (e.g. removing classes) using the method you suggested with the shortcode.

    What I need is the sitemap to appear in 3 columns. (This was the case in the previous hacked code.)

    I have 5 sitemap shortcode calls. (call them A to E)

    I want them to look like
    --------
    A B C
    --------
    D E
    --------

    so 3 columns with 3 appearing on the first row; however, I am now getting the following, after adding the class="--" shortcode to add back the classes I need.

    -------
    A B
    -------
    C D E
    -------
    -------

    Does this plugin provide an easy way to do the columns?

    Thanks.

  10. webvitaly
    Member
    Plugin Author

    Posted 1 year ago #

    Pagelist plugin does not have an easy way to add columns.
    I would recommend you to use CSS multi-column to solve your problem.
    CSS multi-column is supported with all modern browsers.

    Or just try to add this css-code to your theme style.css file:

    ul.page-list {
        -webkit-column-count: 3;
        -webkit-column-gap: 20px;
        -moz-column-count: 3;
        -moz-column-gap: 20px;
        column-count: 3;
        column-gap: 20px;
    }
  11. new_B
    Member
    Posted 1 year ago #

    Hm...that solution doesn't work for me as I'm using the shortcode multiple times for a single sitemap page (generating lists, A-E). The above makes each of A-E into 3 columns each (i.e. 3 x 5 = 15 columns). I'll need to see what changed further. Thanks for your help.

  12. webvitaly
    Member
    Plugin Author

    Posted 1 year ago #

    @new_B: There are some new staff was added to shortcodes:

    Maybe this could help to customize shortcode output on the fly?

    But I didn't fully understand how to use it. Please, check this out, maybe you will have some fresh ideas.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.