WordPress.org

Ready to get started?Download WordPress

Forums

Posts in Sidebar
[resolved] Custom container div classes (9 posts)

  1. Matt Bedford
    Member
    Posted 7 months ago #

    Hi There,

    This a fantastic plugin but I wondered whether you'd consider a few extras. I need to be able to specify a custom class on the containing div. So it would by possible to serve html like so class="widget posts-in-sidebar my-custom-class". Also, the ability to select specific posts to be featured would be great.

    Do you currently have plans to implement any of the above?

    Thanks,
    Matt

    http://wordpress.org/plugins/posts-in-sidebar/

  2. aldolat
    Member
    Plugin Author

    Posted 7 months ago #

    Hi Matt,
    thanks for the kind words! :)

    The container div can't be modified because it's outside of the plugin so I cannot add an option field. You could add your custom class in the source of the plugin, but you'll have to re-add it at every plugin update.

    About the second question, this is something I would add to a future release.

    Bye.

  3. aldolat
    Member
    Plugin Author

    Posted 7 months ago #

    Matt,
    in this thread I wrote something that could be useful for you.
    Take a look there.

    Let me know.

  4. aldolat
    Member
    Plugin Author

    Posted 7 months ago #

    Matt,
    in version 1.15 you will be able to select posts by ID. The new version will be published in the next hours.

    Bye.

  5. Matt Bedford
    Member
    Posted 7 months ago #

    That's great Aldolat thank you so much!

    I appreciate your advice regarding the custom class too but it's not quite what I'm after. I' would like to be able to set a unique class from the widget options panel so each instance of the widget can be targeted via different css. Could something like this work?

    <div id="pis_posts_in_sidebar-2" class="widget posts-in-sidebar">
         <div class="my-class">
         </div>
    </div>

    Something else that would be useful without further complicating the admin would be automatically generated classes on the categories links. This would allow for colour coding.

    <p class="pis-categories-links">
    <a href="http://localhost/lacuna-project/category/design/" titles=View all posts in Design" class="design">Design</a>
    <a href="http://localhost/lacuna-project/category/travel/" title="View all posts in Travel" class="travel">Travel</a>
    </p>

    Again, to keep the admin simple perhaps some of this code could be combined into the parent div rather than specifying a unique class in the admin?

    <div id="pis_posts_in_sidebar-2" class="widget posts-in-sidebar">
         <div class="design-travel>
         </div>
    </div>

    What do you think? Maybe I'm being a bit too specific to my own requirments? lol :-)

    Cheers,
    Matt

  6. aldolat
    Member
    Plugin Author

    Posted 7 months ago #

    Hey Matt, what about targeting each instance via the CSS #id selector? For example:

    div#pis_posts_in_sidebar-2 {
    background-color: orange;
    }
  7. Matt Bedford
    Member
    Posted 7 months ago #

    Hi Aldolat,

    For what I'm try to achieve there needs to be some relationship between the unique class/id and the category as I'd like categories to be colour coded. Being able to set the class in the options panel would make this possible but a more automated approach might be better from an administration point of view which is why I thought of combing relevant categories into the naming convention. This might be too specific to my own needs though?

    Thank,
    Matt

  8. aldolat
    Member
    Plugin Author

    Posted 7 months ago #

    I just committed a new development version (1.16-dev) on GitHub. You can download the zip archive from this page.

    Replace the files on your test site. You'll find a new field in the "Extras" section of the widget panel, named "Custom CSS Class for container": just enter the class and a new div will be created, just as you suggested here. The new div container is created only if a user enter something in this field.

    Let me know, please.

  9. aldolat
    Member
    Plugin Author

    Posted 6 months ago #

    Hi Matt,
    the plugin has been updated to version 1.16, that contains this new feature.

    Bye.

    P.S.
    Please, mark this thread as resolved, if this fits your needs.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags