WordPress.org

Ready to get started?Download WordPress

Forums

TablePress
[resolved] Make specific words a certain colour (6 posts)

  1. MarkFL
    Member
    Posted 1 year ago #

    Hi Tobias,

    I'm a newbie and loving the plugin. I need to add 30 tables which are all very similar and I want to have specific words (such as "Trumpet") that appear in various different cells formatted red. I could do it via the advanced editor I guess (although I can't make the code I put in there work for some reason) but is there a way via the Custom CSS? TY Mark.

    http://wordpress.org/extend/plugins/tablepress/

  2. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Mark,

    thanks for your question.

    The problem here is that CSS code can not be used to find specific content. It can only match "meta" data that is associated to each element on a page.
    Therefore, it is necessary to wrap the desired content (like "Trumpet") in an element that then can be styled with CSS code.

    The solution to this is to indeed wrap the word in HTML code, and the Advanced editor can be used for that, indeed (although it doesn't directly offer a function for this).
    You would basically have to wrap "Trumpet" like this:

    <span class="highlight-red">Trumpet</span>

    similar to how it is explained in the question "How can I highlight certain cells or their content?" in the TablePress FAQ at http://tablepress.org/faq/

    If you have very many occurances of this word, a more automatic solution could be considered. This would however involve programming of a custom Extension in PHP code, that uses the available filters in TablePress to manipulate and extend the data in the table, before it is printed on the page.

    Regards,
    Tobias

  3. MarkFL
    Member
    Posted 1 year ago #

    Thanks Tobias, what a quick reply! It's looking like I'm going to need the custom extension. Cheers, Mark

  4. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Mark,

    no problem, you are welcome for the quick answer :-)

    About the custom Extension: Unfortunately, I don't have the code for this readily available for usage. Also, this is more work than what I can give away as free support right now, due to time constraints and being very busy at the moment. I can however offer to develop this for you, if you compensate me for my time and effort. If that would be an option for you, I suggest that you send me an email (the address is in the main plugin file "tablepress.php"), so that we can discuss details.

    Regards,
    Tobias

  5. cgc-mike
    Member
    Posted 1 year ago #

    Hi Tobias

    I'm trying to do a similar thing by styling a single cell that may move position, so want to do it with...

    <span class="highlight">Text in cell</span>

    and add a class in Plugins - Custom CSS

    .highlight {
    background-color: #ffe400;
    font-weight: bold;

    However while this does change the text to bold it only changes the background directly behind the text and not the background for the whole cell. How would change the background colour for the whole cell?

    Thanks
    Mike

  6. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Mike,

    thanks for your question.
    That's not possible with this approach, unfortunately. The <span> is a new element in the page, and it can not influence the background color of its parent element (the table cell).
    If you really want this, you'll need to use the CSS based approach with column and row numbers from the same question in the TablePress FAQ at http://tablepress.org/faq/

    Regards,
    Tobias

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic