• Resolved sujanm

    (@sujanm)


    Hi Roland,

    If I have a pdb list page which is invoked using a shortcode such as:
    [pdb_list search="true" sort="true" suppress=true search_fields="artist,title"]

    and I do a search which yeilds multiple pages of results the pagination looks fine. It looks like this:

    Correct Pagination Image

    However, if I invoke the exact same shortcode using do_shortcode() i.e:
    return do_shortcode ('[pdb_list search="true" sort="true" suppress=true search_fields="artist,title"]');
    and I do the same search the pagination will not display properly. It will look like this:

    Incorrect Pagination Image

    In seeing why this happens it is apparent that the stylesheet does not get queued properly in the second case. If I force the stylesheet to be enqueued:
    wp_enqueue_style( 'pdb-frontend' );

    then the proper pagination is shown.

    I’m not sure if this is a WordPress issue, or a plugin issue or something I’ve done or something else. Any idea on why the stylesheet has to be enqueued in code?

    Thanks again!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Roland Barker

    (@xnau)

    This is due to the the way the plugin loads stylesheets, which optimally needs to happen early in the load cycle, before the shortcode is invoked in the content. For that reason, invoking the shortcode itself does not load the assets. It would be inefficient to do it that way.

    So, it is normal when invoking shortcodes in your code this way to need to specifically load assets. The plugin doesn’t have any way of knowing in advance that you are going to do that, so the stylesheet isn’t loaded. This can also apply to javascript that is normally loaded with the shortcode.

    Thread Starter sujanm

    (@sujanm)

    Ok understood. Thanks Roland!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Stylesheet not queued on do_shortcode()’ is closed to new replies.