Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Kim White

    (@kimwhite)

    Hello @gooloode,

    This is possible with custom CSS. When a post requires a membership a general class is added to the body tag EX pmpro-body-level-required a class is added to the body for each level. EX: pmpro-body-level-4. You should be able to use these classes to add a unique thing to your post.

    Kim W

    Thread Starter Nico

    (@gooloode)

    Hi @kimwhite , i’m using the Divi Builder and according to the styling of Divi, it should’ve been something along the line of this CSS for Levels 1 and 2. But that doesn’t work.

    .pmpro-body-level-1 .h3 .entry-title::before,.pmpro-body-level-1 .h3 .entry-title a::before,..pmpro-body-level-1 .h3 entry-title::before{content: '(+)'}

    Example Post, restricted to Levels 1 and 2: https://www.gooloo.de/2013/01/example-post-for-plus.html

    • This reply was modified 11 months, 2 weeks ago by Nico.
    Plugin Support Kim White

    (@kimwhite)

    Hello,

    Thank you for the example. Did you want the + before the page title?

    In this page it’s an H1, something like this should work:

    pmpro-body-level-1 h1:before, .pmpro-body-level-2 h1:before {
        content: "+";
    }

    There should only be one H1 on a page.

    Kim W

    Thread Starter Nico

    (@gooloode)

    Hi @kimwhite

    this is limited to the Post Title only when the Post Page is already loaded. I wanted to do something sitewide, so the +PLUS would also be added to f.ex. search results, on archives, etc. I tried this approach, but that doesn’t seem to apply.

    function add_plus_before_title($title, $post_id) {
        // Check if the post type is "post"
        if (get_post_type($post_id) === 'post') {
            // Check if the post requires membership level 1 or 2
            if (pmpro_hasMembershipLevel(array(1, 2))) {
                $title = '+PLUS ' . $title;
            }
        }
        return $title;
    }
    add_filter('the_title', 'add_plus_before_title', 10, 2);
    
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Add a “(+)” before Post Titles that are restricted’ is closed to new replies.