user6571878
user6571878

Reputation:

Is it possible to create a custom page and use WordPress Codex?

I want to ask that can I create a file with my favorite name and use WordPress Codex in it ? How I can do that ? I want to load posts of a unique category in it ...

Note: I don't want to create a Page from WP Dashboard.

Thanks !

Upvotes: 1

Views: 482

Answers (3)

Benoti
Benoti

Reputation: 2210

If you want to create a new php file which will work with your WordPress install, create your new file and copy/paste this piece of code, name this file like you want:

define('WP_USE_THEMES', false);

/** Loads the WordPress Environment and Template */
require ('wp-blog-header.php');

Correct the path for wp-blog-header.php according to where your new file is placed (in this example, the file is at the same level of wp-blog-header.php).

Add your special script to this page and you're done ! Note that this method is a way to display your content in another way than the activated theme. If you want to add function in your plugin or theme, you only need to include it in your functions.php or main plugin file to use WordPress functions, db...

Hope it helps

Upvotes: 0

Andy Tschiersch
Andy Tschiersch

Reputation: 3816

Look at the Wordpress Template Hierarchy

To load posts of a unique category (e.g. movie_cat) you can create a file named category-movie_cat.php.

Wordpress Template Hierarchy- Visual Overview

Click here for a larger version of this picture

Upvotes: 1

Jomol MJ
Jomol MJ

Reputation: 691

It will be better to create a page template and write the code for displaying post from category. Then assign your template to any of the Page in Wordpress Dashboard.

Upvotes: 1

Related Questions