Well, inside your directory just keep a normal php file like my-page.php, and then create a vanity URL for it using .htaccess. Open your .htaccess file (if present in the nstallation directory) or create one
RewriteEngine On
RewriteRule ^my-page-slug my-page.php
Should be good
update
if you want to access WP posts and other objects, you must include “wp-load.php” and you can access regular $wpdb or $WP_query object. Here’s some sample code
<?php
//path/to/your/wordpress/installation/my-page.php
include_once ("wp-load.php");
$posts = get_posts();
foreach($posts as $post){
echo $post->post_name;
echo "<hr/>";
}
Related Posts:
- how to get page id of a page using page slug
- Adding first / last CSS classes to menus
- Mega Menu Walker
- start_lvl Ignored in Custom walker_nav_menu
- Displaying Logged-In User Name in WordPress Menu
- Hide main div if wp_nav_menu is empty
- Menu Items Disappearing
- wp_delete_auto_drafts() deletes links in menus
- Check if a menu is empty?
- how to put the logo in the center of other items in the navigation bar
- renaming an admin menu item with decimal array index number
- How can I hook into and edit the text of a wp_nav_menu tag?
- How to remove a metabox from menu editor page?
- Walker class: Problems with understanding how walk() method can be called without error
- How to Use the Function is_user_logged_in To Display Different Menus?
- Replacing a specific menu item
- How to show only parents subpages of current page item in vertical menu?
- Hide a menu-item and its submenus and display a ‘Log in’ link if the user is logged out
- The best way to customize “nav-menu-template.php” to add if the ‘link_before’ is “checkbox”
- How to create different menu’s for not logged in visitors and for logged in members?
- How to add active class to custom menu using while loop and wp_list_pages
- Hide a specific category title from displaying on site
- How to switch between two primary menus (programatically0
- How to let mobile navigation menu close when link is clicked?
- Redirect User when they click Menu Option
- Used a code to revoke some dashboard menus for my contributors but for some reason it’s revoked me access to the editor [closed]
- Get Child of Child Pages in custom Menu
- How to give custom roles the capability to edit one Menu instead of every Menu
- Primary navigation menu with timed items from custom post type
- PHP warning with code for nav menu walker [duplicate]
- Add element after navigation element title don’t works like I expect
- How to disable sub menu items from being created?
- String replace for Login/Logout concatenation problem in menu
- Bring Font Awesome icons inside menu A tags
- Difference between “Walker_Nav_menu” and “walker”
- Add parent menu item in sub-menu in custom nav_walker
- Exclude a category slug on pagination
- How to create a sub-page of sub-page?
- Fatal error when using array_diff() function inside of wp_update_nav_menu hook?
- Vertical Menu for one page only
- Display specific main Sub Nav on Woocommerce product pages
- PHP drop down menu for my get_category child of
- How can I output the slug of a comment author?
- Widget Logic – display on page and all child
- How limit the width of a fixed menu-bar on scroll?
- Pulling a variable into the wp_nav_menu function
- Beyond widget side menu editing, with the php page, custom template
- How to list categories by page id in wordpress
- Adding button to wordpress menu
- WordPress using get_term to retreive slug not working as expected
- Editing existing pre-created menus in PHP
- Two theme locations for two menus, but only one is showing up
- wp_nav_menu doesn’t work in a duplicate server
- How I can add div to menu?
- wp_nav_menu prints children with parent name
- wp nav menu without label
- Contact form field in wordpress menu
- Weird slug in archives permalink
- WP Admin Bar – Get current theme name as custom menu title
- Add extra markup to WP menus
- php string inside shortcode does not work
- How to call a certain object/menubar in a PHP file
- Active class not working on custom menu link using add_menu_page
- Sidebar current menu item for parent
- Using ‘array’ method in wp_nav_menu causes it to disappear
- Remove all nav menu classes except those which begin with certain letters
- How to add a code for lastpostdate after/inside a specific menu link?
- Add the “.current-menu-item” class to tag?
- How to get the count for each taxonomy term
- get_category only returning details for ‘uncategorized’
- WP_Nav Highlight Parent Issue
- WordPress adding in site URL to header links
- How to change the menu color
- Can’t remove menu items added by plugin
- Custom Links in Walker Class
- Submenu opened problem
- if is_home(), change class of menu-item-225 of wp_nav_menu
- Nav Menu Display
- Adding a unique class to wp_nav_menu
- Change order that the menu is generated with wp_list_pages
- I am extending Walker_Nav_Menu: How can I get the number of children elements of the current item?
- How do I modify the with wp_nav_menu()
- Make a permalink to the most recent blog post
- WordPress menu links with images & class selection
- Open WordPress Page from selected option dropdown
- Inserting a shortcode into a genesis menu?
- Remove Unused Menu Locations
- Custom Navigation Bar JSON Syntax Error in JSON at Position 0
- How to add different menu items on different menus?
- How to disable page create for custom post type, but allow a page with the post types slug to be created?
- Remove /Page/ from slug when we’re visiting 2nd and other inner pages of the blog page
- Custom nav with bootstrap dropdown
- Create a custom plugin with dynamic child pages listing database records
- Nav menù doesn’t display selected pages
- Show a text in menu
- make my custom theme support polylang plugin
- Can’t assign menu parent id or menu item breaks
- What is considered good practice for registering menu locations?
- How to Customize the Admin Sidebar Menu in WordPress Multisite Network by changing the backend code of the wp-admin code files?
- Custom plugin with dynamic child pages listing database records