WordPress.org

Ready to get started?Download WordPress

Forums

WP-Members
Custom Post Type excerpts give "This content is restricted" text (3 posts)

  1. evster
    Member
    Posted 1 year ago #

    Hi first off many thanks to Chad for making such an amazing plugin!

    I seem to be having a problem with custom post types. I have my main "posts" page for my custom post type is set to display excerpts, but instead of an excerpt from my actual post I get the following message:

    This content is restricted to site members. If you are an existing user, please login. New users may register below. Existing Users Login Username Password Remember me New Users RegistrationChoose a Username* First Name* Last Name* Address 1* Address 2 City* State* Zip* Country* Day Phone* Email* *Required field Powered [...]

    I have tried simplifying my loop for the custom post type page down to the following (which I borrowed from http://codex.wordpress.org/Post_Types, but I still get the same "content is restricted" message:

    $args = array( 'post_type' => 'product', 'posts_per_page' => 10 );
    $loop = new WP_Query( $args );
    while ( $loop->have_posts() ) : $loop->the_post();
    the_title();
    echo '<div class="entry-content">';
    the_excerpt();
    echo '</div>';
    endwhile;

    FWIW, the main blog page of my site is also set to display excerpts and works just fine.

    Here are what my plugin settings currently look like, though the issue seems to be happening whether or not the "Show excerpts" option is checked or not: http://evanwebdesign.com/screenshots/WP-Members.png

    I am using the "Intent" theme from http://themeforest.net/item/intent-business-portfolio-wordpress-theme/2511967 which may be causing some kind of conflict, but I can't pin it down at this moment.

    If anyone can shed some light on this issue it would be greatly appreciated.

    Thanks!

    http://wordpress.org/extend/plugins/wp-members/

    UPDATE: If I manually unblock a post from my CPT withe the "unblock" custom field, then the excerpt works.

  2. Chad Butler
    Member
    Plugin Author

    Posted 1 year ago #

    Depending on how the custom post type is structured, the plugin may not be able to be used in that situation without some modification.

    The main part of the plugin protects content by taking the WordPress $content variable that is returned from the_content and replaces it with the login/registration form if the user is not logged in.

    Without knowing more about the theme's custom post type and use of the excerpt, it appears that it is making the excerpt after the_content has been filtered by WP-Members, so it's making an excerpt of the post restricted message and the form.

    You might be able to overcome this by changing the way this particular custom post type grabs the excerpt when is_user_logged_in is false.

  3. evster
    Member
    Posted 1 year ago #

    Thanks Chad for the detailed response! I had a feeling the issue was something along the lines of what you mentioned, but it definitely helps to have some confirmation.

    For the time being I've restructured the navigation of the site to include a landing page for members to log into before they are given a link to the CPT blog page. That makes this issue much less important, since I anticipate over 90% of the users won't see the CPT blog page until they're already logged in.

    I will do some research on how the theme grabs the CPT excerpts and see what I can figure out.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic