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
- Hide main div if wp_nav_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 to remove a metabox from menu editor page?
- 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
- How to place login logout link on menu that redirects users back to current page?
- wp_delete_auto_drafts() deletes links in menus
- Unusable menus and “Illegal widget setting ID: nav_menu_item[]” error
- Logout and redirect using the WP Menu
- Creating new menu item
- Programmatically create menu with custom link
- Custom Loop through category menu to include sub categories
- Get ID of child from child slug, while knowing parent ID
- Get posts with at least one category in common with current post?
- wp nav menu: add attributes to menu items [duplicate]
- Have CSS Class Added with `is_page()` WP function
- Add itemprop Schema.org Markup to li Elements in wp_nav_menu
- Run a filter when a walker runs
- Change Navigation Bar based on logged in or not
- create a select input with menus created on a custom options page
- How do you use WP slugs for PDF files / media?
- WordPress plugin for nicer looking slugs? Have multiple pages named the same but they get different slugs
- How can I Add a variable PHP in the Menu Nav
- Where to place PHP code that inserts (or doesn’t insert) menu item?
- What is an equivalent of single_cat_title for getting the slug of the category?
- Adding an Avatar to the Top Nav Bar
- Add data attribute to each li in menu
- Remove metabox from WordPress menu editor page?
- How to add an arrow to menu items has submenus
- wp_nav_menu returns menu list in ascending order. How can I arrange the menu same as dashboard menu
- Unique icons next to each WordPress menu item
- Secondary navigation menu on one page
- Remove class in nav_menu_link_attibutes filter
- WordPress Quick Question . How to Get Parent Link in Submenu in My Code
- Detecting classes, adding widgets, and adding divs in with a Nav Walker
- Adding PHP in the menu
- List taxonomy term slugs within shortcode (do_shortcode)
- Show About and Contact Us page when they’re clicked in the top menu.
- New walker for walker_nav_menu to change inside container data
- Add data-id attribute to child page links
- Add login hyperlink to secondary navigation menu
- wp_nav_menu not working correctly in my underscores theme
- Notice: Trying to get property of non-object
- How to use wp_nav_menu to create custom dropdown menu?
- Get css class of menu item in custom menu structure
- Adding Additional Variables on Menus Page
- Nav-Menu not showing up
- Show login greeting above sub-menu links?
- How to tell if a user has gone in and created a menu
- Class for Selected Menu using wp_nav_menu
- Hard-coding a shortcode as the last menu item in primary navigation?
- Add class to ul and li in wp_na
- Nav Walker that shows only children and siblings of top level parent menu item
- how to changes mobile menu toggle breakpoint in WordPress
- How to display already created menus via php?
- Providin exception to WordPress wp_nav_menu Custom CSS Classes
- Allow two posts (from different categories) to have the same slug
- Test the existence of a page/article by its URL, taking in consideration the URL rewriting by filters
- Adding markup to sub menu based on class
- Featured image in menu wordpres
- Custom PHP form needs refresh to load page correctly
- dynamic php menu with hidden sub-categories only showing when the category name is clicked
- Slug duplicates once clicking on link
- Rewrite rule not working, but only when parameter is text
- Menu not updating for logged in users after redirect
- Hide a specific category title from displaying on site
- How to let mobile navigation menu close when link is clicked?
- PHP warning with code for nav menu walker [duplicate]
- Add element after navigation element title don’t works like I expect
- String replace for Login/Logout concatenation problem in menu
- How to create a sub-page of sub-page?
- How can I output the slug of a comment author?
- Widget Logic – display on page and all child
- 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
- 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
- Weird slug in archives permalink
- WP Admin Bar – Get current theme name as custom menu title
- Add extra markup to WP menus
- Using ‘array’ method in wp_nav_menu causes it to disappear
- How to get the count for each taxonomy term
- get_category only returning details for ‘uncategorized’
- WP_Nav Highlight Parent Issue
- Submenu opened problem
- if is_home(), change class of menu-item-225 of 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()
- Inserting a shortcode into a genesis menu?
- Custom Navigation Bar JSON Syntax Error in JSON at Position 0
- How to add different menu items on different menus?
- Nav menù doesn’t display selected pages