Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

Login “Lightbox” for specific category content

Don’t know about a plugin that does that for you but you can use the WordPress native Thickbox:

enter image description here

First include the Thickbox script and style in your category only if the user is not logged in (simply copy/paste in your theme’s functions.php file)

function add_thickbox_script_and_style(){
    if(is_category('YOUR_CATEGORY') && !is_user_logged_in()){
        wp_enqueue_script('jquery');
        wp_enqueue_script('thickbox',null,array('jquery'));
        wp_enqueue_style('thickbox.css', "https://wordpress.stackexchange.com/".WPINC.'/js/thickbox/thickbox.css', null, '1.0');
    }
}
add_action('init','add_thickbox_script_and_style');

Then open up your category.php (or archive.php depending on your theme , or even better is a custom file for that category category-id.php) and add this code before the loop:

if (is_category('YOUR_CATEGORY') && !is_user_logged_in()){
    echo '<div id="lform" style="display:none;">';
    wp_login_form();
    echo '</div>';
    echo 'Please <a class="thickbox" href="#TB_inline?height=200&width=200&inlineId=lform">Login</a> to see the content';
}else{


//your loop goes here

}

Related Posts:

  1. WordPress check if user is logged in from non wordpress page
  2. User level categories
  3. Invalid login email notification for password-protected category
  4. How to create an automatic MultiColoumn MegaMenu with Categories WordPress
  5. Is There a Difference Between Taxonomies and Categories?
  6. List all subcategories from category
  7. How To Find Out WordPress Category Table in MYSQL?
  8. Add custom field to Category
  9. Get Category ID inside Category template
  10. Only one category per post
  11. WordPress Multisite – global categories
  12. Get the children of the parent category
  13. Get posts from sites in Multisite?
  14. WP REST API: filter by category 1 AND category 2
  15. How To Get Parent Category Slug of Current Post
  16. Display All Products by Category with WooCommerce
  17. What is the difference between a “tag” and a “category”?
  18. Is there an easy way to make a meta box have the tabs like the Categories meta box has?
  19. How to check if I’m on the last page of posts?
  20. Display posts from the same category using next/previous post link
  21. How would I get a taxonomy/category list inside a Gutenberg block?
  22. Can I set a default featured image for a category?
  23. Check if a post is in any child category of a parent category
  24. How to export and import taxonomies (category, tag and/or custom taxonomy) and their terms
  25. Force category choice before creating new post?
  26. Gutenberg editor add a custom category as wrapper for custom blocks
  27. WooCommerce: List All Categories
  28. How to get category and archive title?
  29. Get category ID from category slug (not working)
  30. How do I remove “Uncategorized” from posts with more than 1 category?
  31. Get rid of WordPress category, tag and author archives?
  32. Individual rss feed entry length for categories?
  33. How can I create a category landing page followed by pages of posts?
  34. Remove parent category from permalink? Basically only have the child category?
  35. Custom permalink structure leads to be 404 on pagination
  36. Retrieve Product category ‘NAME’ by product category ID – WooCommerce?
  37. Posts URL structure like site.com/category/the-post-title
  38. Can’t custom taxonomies have same terms (slugs) as categories?
  39. How to get permalinks with category base working with sub-categories
  40. How to remove the term “category” from category pagination?
  41. Using wp_category_checklist in a widget
  42. WP 3.9 TinyMCE no longer loads on category description editor
  43. On the category page, get the category object
  44. Get only the top level categories using get_categories() without foreach loop
  45. Get all categories and posts in those categories
  46. How to add featured image for category (without a plugin)?
  47. How to create a custom sort for WordPress categories
  48. How to display non-hierarchical taxonomy as terms with checkboxes?
  49. Category archive by year with permalink support /category/YYYY
  50. Best Way to Redirect Category to Page and Hide Category
  51. get_terms vs. get_categories: does it matter?
  52. What is a good robots.txt?
  53. Allow users to create their own feed from selected categories?
  54. Hook when category is added to post
  55. get_categories for custom post type with a specific custom taxonomy attached
  56. Add a URL prefix to permalinks of one category of posts only
  57. How do you add categories to custom post types in WordPress?
  58. Create a category list page
  59. Catch 404 after changing permalink structure from /%postname%/ to /%category%/%postname%/
  60. Woocommerce get category image full size
  61. exclude category from get_posts?
  62. How To Modify The Loop in archives.php To Have 11 Posts Per Page and CSS Styling
  63. How can I hide a category from Contributors in the edit/add new post screen?
  64. Order get_terms() By Custom Field
  65. WordPress Multiple Category Search
  66. Should category.php and The Loop be used if the query needs to be customizable?
  67. How do the ‘tag’ and ‘category’ (default) taxonomies do ‘save_post’ action?
  68. How to Change the Categories Order in the Admin Dashboard?
  69. Control term order on a per-post basis
  70. How to remove categories filter from wordpress admin?
  71. get all tags from category
  72. Could not insert term into the database
  73. How can I add the featured image functionality to a custom taxonomy?
  74. Activate Gutenberg in category-descriptions
  75. Filter by post category in Media Library
  76. Filtering categories in the permalink structure
  77. Share one taxonomy across multiple blogs in 3.0 [duplicate]
  78. 404 Error On Category and Tags Pages
  79. How to show subcategories in categories else show posts
  80. Allow duplicate permalink slugs for posts in different categories
  81. Exclude the category from the WordPress loop
  82. get_categories hierarchical order like wp_list_categories – with name, slug & link to edit cat
  83. How to make child categories recognize parent’s template displays
  84. Force WordPress to Show Pages Instead of Category
  85. Completely disable categories
  86. How do I get the category URL from get_the_category?
  87. Display Image for a category using get_categories, or show an image from any child post
  88. Remove / Rename Uncategorized Category In WordPress
  89. Fixing category count
  90. Change Gutenberg category checkboxes to radios
  91. Can a Child Category Have More than One Parent?
  92. is_category() in pre_get_posts strange error
  93. Combine two taxonomies in a hierarchical tree
  94. Checklist of selected categories
  95. How to get posts from two categories with WP_Query?
  96. Group WP_Query by category
  97. Multisite – Protect categories from deletion?
  98. Decreasing the Memory Consumption of a WordPress Site?
  99. How do I use the same post slug for different Categories?
  100. Where/how are categories stored?
Categories categories Tags categories, login
Query 1 taxonomy term, exclude another
Using WPAlchemy metabox values in another metabox

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress