Add Category to Pages - Version 1.1

Version Description

Download this release

Release Info

Developer a.ankit
Plugin Icon 128x128 Add Category to Pages
Version 1.1
Comparing to
See all releases

Version 1.1

Files changed (2) hide show
  1. add-category-to-page.php +39 -0
  2. readme.txt +69 -0
add-category-to-page.php ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php /**
2
+ * Plugin Name: Add Categories to Pages.
3
+ * Plugin URI: https://spicewp.com
4
+ * Description: Easily add Categories and Tags to Pages. Simply Activate and visit the Page Edit SCreen.
5
+ * Version: 1.1
6
+ * Author: a.ankit
7
+ * Author URI: https://spicewp.com
8
+ * License: GPL2
9
+ */
10
+
11
+
12
+
13
+ function add_taxonomies_to_pages() {
14
+ register_taxonomy_for_object_type( 'post_tag', 'page' );
15
+ register_taxonomy_for_object_type( 'category', 'page' );
16
+ }
17
+
18
+ add_action( 'init', 'add_taxonomies_to_pages' );
19
+
20
+
21
+ add_action( 'pre_get_posts', 'category_and_tag_archives' );
22
+
23
+
24
+ // Add Page as a post_type in the archive.php and tag.php
25
+
26
+ function category_and_tag_archives( $wp_query ) {
27
+
28
+ if( $wp_query->is_main_query() && ! is_admin() && ( $wp_query->is_category() || $wp_query->is_tag() )) {
29
+ $my_post_array = array('post','page');
30
+
31
+ if ( $wp_query->get( 'category_name' ) || $wp_query->get( 'cat' ) )
32
+ $wp_query->set( 'post_type', $my_post_array );
33
+
34
+ if ( $wp_query->get( 'tag' ) )
35
+ $wp_query->set( 'post_type', $my_post_array );
36
+ }
37
+ }
38
+
39
+ ?>
readme.txt ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Add Category to Pages ===
2
+ Contributors: a.ankit
3
+ Donate link: https://spicewp.com
4
+ Tags: page, category, category in page, tag in page, page archive, pages
5
+ Requires at least: 3.3
6
+ Tested up to: 4.9.8
7
+ Stable tag: 1.1
8
+
9
+ Easily add a Post Categories to Wordpress Pages
10
+
11
+ == Description ==
12
+ The **Add Category to Pages** plugin allows you to quickly add Categories and Tags to your Wordpress Pages.
13
+
14
+ This plugin allows you to add the power of Wordpress Taxonomy to Wordpress Pages.
15
+
16
+ Just activate the plugin and it will add category and tag support to Wordpress Pages
17
+
18
+ = Features =
19
+ * Adds Post Categories to Pages
20
+ * Adds Post Tags to Pages
21
+ * Lets you display List of Pages based on Categories
22
+ * The plugin utilizes the archive.php and tag.php file included in your theme.
23
+
24
+ The plugin is based on this [Tutorial] (https://spicewp.com/add-categories-tags-pages-wordpress/)
25
+
26
+ = What are the benefits ? =
27
+ There are various benefits of adding category to Pages YOu can
28
+ * Embed a Category Based List of Pages
29
+ * Create a Tag based archive for Pages
30
+ * Create a Category based Archive for Pages
31
+ * Hide Pages belonging to certain Category.. and Lots More
32
+
33
+
34
+
35
+ In case you face any problem, contact us via the [Forums]().
36
+
37
+
38
+
39
+ == Changelog ==
40
+
41
+
42
+ = Version 1.1 =
43
+ * Initial Plugin Release
44
+ * Fixed the issue Break other plugins wp-query
45
+
46
+ = Version 1.0 =
47
+ * Initial Plugin Release
48
+ * Adds Post Categories and Tags to Pages in Wordpress
49
+
50
+ == Installation ==
51
+
52
+ This section describes how to install the plugin and get it working.
53
+
54
+ 1. Unzip archive and upload the entire folder to the /wp-content/plugins/ directory
55
+ 2. Activate the plugin through the 'Plugins' menu in WordPress
56
+ 3. Now Visit the Page editing Screes
57
+ 4. You can now add Categories to Pages just like you do it in Posts
58
+ 5. Enjoy. Eat Drink and be Merry !!
59
+
60
+
61
+ == Screenshots ==
62
+
63
+ 1. Page Edit Screen
64
+
65
+
66
+
67
+ == Frequently Asked Questions ==
68
+
69
+ The FAQ section will be updated in next release.