try this:
<?php
//first check if its the category in question
if ($cat == '1') {
//then if the user is logged in show the content
if (is_user_logged_in()){
the_content();
}else{ //if not show the excerpt
the_excerpt();
}
}else{ // and if its not the category show the content
the_content();
}
?>
Update
Judging by your comments you are some defining $cat
before the check so add:
$cat = get_query_var('cat');
before the conditional code.
Related Posts:
- How to restrict attachment download to a specific user?
- Using JWT to authenticate a user with an external system?
- Allow anonymous user to access Themes Customizer
- Is there an existing capability to allow editing of only pre-existing pages? If not, a good way to implement this?
- How to make user inactive by default while registering?
- How to set privilege to wordpress subscriber for private page
- authenticate user without password from email activation link [duplicate]
- User Access Manager plugin
- How can we Restrict to access a certain wordpress page to all ip address except some which we allow
- Restrict post to user_id
- add_option_page capability behaving strange
- Access denied on Published Pages but not on WordPress /wp-admin/
- Allow non logged users to visit only login page and password reset page
- How can I allow users to make groupings of posts
- Is user listing on wordpress private?
- How to restrict logged user to view only certain pages?
- Limit post display to post authors and create an exception for specific pages
- How to “Global Ignore” / “Hell Ban” someone, restrict post visibility to the author only?
- Conditional menu for registerd users/guests (Genesis framework)
- How can I create an upload page for (and only visible to) specific users?
- remove wp admin menu by customer user role
- Custom Roles for access to specific term(s)
- ‘post’ only for editor and administrator
- Why: sticky front page code, shows latest non-sticky on logged-in front page
- Access denied error when logged in as admin
- Disable all admin UI access to authors (except to custom post type add, edit and modify)
- Hide all pages except landing page
- How to restrict access to a page?
- How can I change access permissions across many pages?
- How do I get the access type in WordPress?
- Profiles site with access levels
- User access control in sidebar archive and categorires
- Plugins that restrict access based on user group/roles
- Restrict access for wp-admin panel
- Specify the level of access to different pages at the time of user creation
- When add analytics script, wordpress user login not working
- Hide WordPress “wp-admin” dashboard to User IDS
- I cannot access but but wp-admin works normally
- about visibility in wordpress regarding of roles
- Can access main URL and Dashboard but not any posts or pages [closed]
- How to List only the users created by a particular user
- How to enable to the user send content and save as draft entry?
- How to give members access to their own protected page?
- Use WordPress engine for user registration and management
- How to make future posts visible to selected visitors without login
- Add existing user as administrator
- Split post edit screen into sub-edit screens for users, is this good or bad, and is it possible?
- Suggestions for allowing basic users to view their own posts?
- Two users attempt to modify a page
- How to get all capabilities of an existing user role
- How do you add a custom option to user data?
- how to add custom user capabilities using add_user_meta or something else?
- Restrict acceess of a page in backend
- How to display only logged in user’s post comments in comments area
- Allow Users Access to Custom Post Type Only
- Can’t access WordPress as an admin – but I can log in as a user!
- Managing Users and Creating Groups [closed]
- Upgrade Nightmare – No Posts, Permissions Issues and Can’t Create a new post
- admin_post action not usable if admin access denied to user
- How to restrict CPT post’s fronted view only for specific user roles?
- How to protect post attachments related to a custom post type, from non-logged in users, on 1 subsite of a multisite installation?
- Restrict access of admin uploads to certain logged-in users?
- WordPress login problem
- Only Allow Front End Access
- Reset Password policy
- Assigning certain authors to specific editors
- How to add a private user page populated from sql?
- Lost administrator privileges and can’t find a fix
- Filtering the Admin Comments List to Show Only Comments from the Current User?
- Limit a user to have access to only specified pages?
- Check if user registered more than a month ago
- How to change footer or for different kinds of users in wordpress?
- Add access control origin header information across multisite
- How can I stop access of unregistered user in wp-content/uploads directory without using .htaccess file?
- Grant a person permission to moderate all comments on a blog without giving them the ability to edit other peoples post
- How can I create a custom plugin that allows anonymous users to signup without registering?
- Restrict custom post content to specific user
- Auto log in hook is requiring a page refresh
- Make (custom) post type accessible only by custom query
- Adding guestbook to my wordpress site
- Unique password to access a section site
- Specific plugin for custom user information access? [closed]
- Allowing WordPress.org/com accounts on a self-hosted install
- How to add a custom filter (by coding) before access one wordpress page ? And where to call the custom filter?
- Plugin or ways to limit number of users logging in the website,
- How to add a “base” filter for all posts visible to visitors on the site?
- How to make WP page accessile only to specific user roles
- hide theme files for admin beneath root
- Doesn’t call user information to include “wp-load.php” in an external php file
- is_user_logged_in() returns different values on different pages
- Redirect non-admin after login, and in url – /admin
- How to password protect pages in WordPress
- How can hackers access WP usernames? [duplicate]
- Moved WordPress Directory – Having access issues now
- Standard way of creating profile pages with custom content for each user?
- Capability to read/edit page in wp-admin only for administrators
- Limit user access to installing/configuring a plugin?
- file upload user profile
- You do not have permission to access this document on form submit
- How to give different user access to different people?