First of all include wp-load.php from WP root installation to those PHP files which you want to display and once you have included to your PHP files then you can use WP functions. You can use is_user_logged_in() function to check if user is logged in or not.
// Your PHP file that can be viewed only to logged in user
require_once '/path/to/wordpress/wp-load.php';
if ( is_user_logged_in() ) {
// your php file code...
}
And same you can do for HTML by converting them to PHP files and include those above line of code.
Related Posts:
- WP_Query() load selected post
- echo var into wp_query
- How to get post category list as select in front-end?
- Order a WP_Query by meta value where the value is an array
- How do I check if there is a tag in the title
- Is it legal to redefine wp_password_change_notification in a mu plugin?
- How to extract information from a wp_query result?
- insert thumbnail image from php script
- WP_Query count of different meta key values [duplicate]
- WooCommerce – Print Processing orders [closed]
- Querying posts based off a jquery datepicker
- Masonry layout within the loop
- use system script advertising in wordpress multisite
- Weird Behaviour: Not all WordPress Posts appearing
- WP Admin Bar – Get current theme name as custom menu title
- List of child pages fetch next results at link click
- Use custom get results query to show posts WordPress
- List sibling pages widget, exclude current page
- Query category-specific, paginated posts and allow viewer to change sort order
- wordpress is_main_query() breaks
- Query seems to be duplicated
- Why does WP_Query show only the same post even with different categories and endwhile?
- allow previews outside wordpress folder (Outsourcing WP previews)
- How to get category pages to look like a certain archive page?
- show/hide attachments
- WPMU schedule doesn’t execute actions
- Post Title Not showing up
- Advanced Taxonomy query, with 3 post types
- WP Query conflict on tag.php and category.php template
- WP multisite network plugin fails to see classes loaded with spl autoload
- Host does not allow remote connection, so how do I transfer data to my WordPress site?
- Trying to post information from a remote database to wordpress page
- reorder a WP_Query, using a dropdown
- Custom PHP-coding in MU installs
- .htaccess on multisite and roots theme?
- Force string into signup form
- Custom query_posts() parameter
- WP_Query based on another query on the page
- Why does a meta_query break this WP_Query?
- Does wp_query and query_posts affect website performance? [duplicate]
- Keeping the previous get value and add another value when submitted
- WordPress post pagination on custom template not working
- Ajax Load More or View More functionality for woocommerce category layout by template overriding
- Pagination in category.php not functioning
- How to modify this function to exclude also the post belonging to a specific category?
- Fix incorrect related posts code snippet
- wp_query on search results page showing all results every time
- I need a button to appear when not loged in and another when logged in, I need help fixing code PLEASE!
- WPMU – How to echo only one URL
- Show post like this image in my newssite [closed]
- Display biography post for today’s birthday person
- WP query with variables gives no result for specific user
- Losing Session ID and sessionStorage when navigating to other domains on Multisite
- Display all categories (with link) of custom post type – WordPress
- Changing regular db connection to $wpdb
- How do I run the following script from my articles page?
- Variable ++ in query loop
- Execute multiple PHP Snippets causes error?
- XML WP_Query problem in PHP 8.0 and 8.1
- a problem in class in class-wp-hook.php
- How to initialise WP_Query on the basis of a specific meta_value and continue iterating rest?
- Count custom posts type and filter by tag
- Three different queries on same page
- How to sort custom sortable column by custom table value
- /page/2/ redirect to 404
- How to use a conditional statement in a post loop but not count towards the “posts_per_page” if false
- AJAX WP_Query’s order and orderby parameters not working
- Add adjacent post function inside custom recent post function
- add_rewrite_rule image from /images/site2/favicon.ico to /favico.ico
- How to sort search result by post_title, then by post_content
- Internal server error when enabling Multisite in WordPress
- How do I exclude the current post from the upcoming post query
- How do I display WooCommerce products in my query to rows of 3?
- How to get posts by a certain author in inner loop using outer loop variable or post title WordPress
- wp_logout action hook is not firing
- How to create a build for quickly deploying a server with WP?
- How to show correct td of table tags in wp_query loop
- Exclude first post from wp query
- Show post in elementor based on views and specific category with query id feature in elementor
- NGINX rewrite rules for WordPress Subdirectory Multisite to support deep URL
- Single wordpress multi website down need help factoring what it is
- Check for a value in a custom query
- Change WordPress Multisite Domain to subfolder
- How to make posts_like_dislike reference current post when iterating?
- AND and OR in my CPT search query depending on checkbox
- Add css class ID to largest and smallest number a custom field in wp_query
- Enabling pretty permalinks with Docker, Multisite WordPress and Caddy
- Running WP-Cron on Multisite networks the right way?
- External WP_Query call from PHP crashed after version update
- How could I prevent using the same custom loop in a template file when I only need to change one meta_query parameter?
- Add up all numbers from a WordPress query [closed]
- How to add query string at the end of sitemap Yoast SEO
- How to Customize the Admin Sidebar Menu in WordPress Multisite Network by changing the backend code of the wp-admin code files?
- Custom theme on multisite has issues with standard loop output
- Set custom post type to load custom block pattern by default
- Developing a “fallback” for empty wp_query results based on post dates
- Display posts in correct month order using single date custom field
- How can I save the HTML output of a WP_Query function as a variable?
- WordPress query_posts with multiple tax_query
- REST API request between domain and subdomain