• Resolved Jürgen H?rmann

    (@hoermannj)


    Hi.

    I use your plugin on every Worpress Site I set up. It is absolutely great.

    One feature I’m missing right now is the possibillity to add a custom class to the shortcode (and widget). Basically what I do is creating blocks for different layout positions that get different styling per position. Unfortunately some themes do not assign css classes to parent elements to properly address the output of the Custom Post Widget.
    Additionally if your theme is based on a css grid framework like bootstrap you can assign grid-width classes to easily fit the Custom Post Widgets into the page layout.

    Maybe you can extend the shortcode like [content_block id=47 slug=my-block class=col-md-8] and/or add a field “css class” to the edit page.

    Thanks for this great Plug-In

    https://www.ads-software.com/plugins/custom-post-widget/

Viewing 7 replies - 1 through 7 (of 7 total)
  • … And if We Could Also select a background from the image gallery.

    Then it would be perfect. ??

    Thanks

    Plugin Author Johan van der Wijk

    (@vanderwijk)

    Hi Jürgen, the functionality for adding a custom class to the shortcode is already there. It works exactly like in your example. I have updated the FAQ since this feature was not documented yet.

    When using the widget the plugin automatically adds an ID to the surrounding div like so: id="custom_post_widget-17". Because it includes the post ID of the content block, it is always unique. Also, the class widget_custom_post_widget is added to the div.

    @luis: You can use the classes and/or ID as mentioned above to add a background to the widget.

    Thread Starter Jürgen H?rmann

    (@hoermannj)

    Great!

    Thank you very much Johan

    Hi Johan van der Wijk,

    “When using the widget the plugin automatically adds an ID…”

    Unfortunately this seems to be “widget order” id and not the real post-id. What do you think?

    Thank you.

    Plugin Author Johan van der Wijk

    (@vanderwijk)

    Hi Stephan,

    You are correct, when using the shortcode the post ID is added to the div but when using a widget this is the widget order. I had not noticed this difference before but it is not something I can change now (because this will affect existing websites). But since both ID’s are unique, this should not be a problem though.

    Hi Johan van der Wijk,

    Yes I understand you can’t back for the div id. However you can add a class like “custom-post-great-plugin–widget-for-post-id-***”.

    Thank you.

    Plugin Author Johan van der Wijk

    (@vanderwijk)

    Yes, that would probably be possible but why would you need that if you already have a unique ID to apply your styling to?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Custom Classes for Shortcode’ is closed to new replies.