WordPress.org

Ready to get started?Download WordPress

Forums

Paid Memberships Pro
[resolved] Shortcode to show or to hide content (11 posts)

  1. pazis
    Member
    Posted 1 year ago #

    Thank you for your prefect plugin. Is there any way to hide/show a piece of content? i.e shortcodes like:

    [showto levels="1,2"]content[/showto]
    [hidefrom levels="1,2"]content[/hidefrom]

    http://wordpress.org/extend/plugins/paid-memberships-pro/

  2. pazis
    Member
    Posted 1 year ago #

    Oh I found it out myself..

    [membership level="1"]Will only show up for level 1 users[/membership]

    [membership level="-1"]Will show up anyone not in level 1, including non-members[/membership]

    [membership level="0"]Will show up for non-members.[/membership]

    But how to use it in sidebar widgets!?

  3. pazis
    Member
    Posted 1 year ago #

    Well I found it out myself!

    <?php if (pmpro_hasMembershipLevel(3) ) { //only members can see this ?>
    TEST
    <?php } ?>

  4. pazis
    Member
    Posted 1 year ago #

    RESOLVED!

  5. rwilki
    Member
    Posted 1 year ago #

    AWESOME! I've been looking for this for hours!

    Thanks,
    Bob

  6. amberrenee01
    Member
    Posted 1 year ago #

    this seems to be exactly what i was looking for also!! and you figured it out on your own!! man, you are just all kinds of awesome! Thank you!!

  7. Lisa
    Member
    Posted 1 year ago #

    You can use in your widget area if your theme allows shortcodes in your widget area. If not you can add the following to your theme's functions file:

    add_filter('widget_text', 'do_shortcode');

    This should allow you to use any shortcodes in your widget areas, not just PMPro's.

  8. MadCoder
    Member
    Posted 1 year ago #

    I'm using Kallyas theme, and most of the pages I use are widget based, however... PMP will properly hide the page static content, but not the widgets used on the page.

    Any help would be greatly appreciated.

  9. PMPro-Lisa
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Mad Coder

    Use the shortcodes to hide content within the widget areas.

    If you would like more guidance or hands on help implementing this solution with Paid Memberships Pro, please sign up at http://www.paidmembershipspro.com/pricing.

  10. rwilki
    Member
    Posted 1 year ago #

    Or MadCoder, you could use the php template code to hide the sidebar widget entirely based on the viewer's membership level. It works great. Put the code into your sidebar template file.

    Thanks,
    Bob

  11. hg
    Member
    Posted 1 year ago #

    Hi guys,
    What is the shortcode to make the content to show up for members level 1A and 1B?

    Thanks.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags