From: Anthony Talarico Date: Thu, 10 May 2018 16:20:35 +0000 (-0400) Subject: changing footer and header styles , adding custom post types for the parallax and... X-Git-Tag: v1.0.0^2~42 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=cdc13ef587fc2d317d2a331af0798083bd1756b1;p=WP-Themes%2Flaurium.git changing footer and header styles , adding custom post types for the parallax and panel sections --- diff --git a/functions.php b/functions.php index 1848cda..cd6f678 100644 --- a/functions.php +++ b/functions.php @@ -206,6 +206,7 @@ add_action( 'wp_enqueue_scripts', 'accesspress_parallax_scripts' ); */ require get_template_directory() . '/inc/rooms.php'; require get_template_directory() . '/inc/blog.php'; +require get_template_directory() . '/inc/parallax.php'; /** * Implement the Custom Header feature. */ @@ -301,4 +302,10 @@ if (!function_exists('glm_get_clientinfo_option')) { ? $settings[$name] : null; } +} +add_action( 'admin_init', 'posts_order_wpse_91866' ); + +function posts_order_wpse_91866() +{ + add_post_type_support( 'post', 'page-attributes' ); } \ No newline at end of file diff --git a/inc/accesspress-options.php b/inc/accesspress-options.php index d9ae622..9f374c7 100644 --- a/inc/accesspress-options.php +++ b/inc/accesspress-options.php @@ -70,10 +70,17 @@ function optionsframework_options() { $options_tags[$tag->term_id] = $tag->name; } + $args = array( + 'post_type' => 'glm-parallax', + 'cat' => 'welcome', + 'posts_per_page' => -1 + ); + $count_service = 0; + $query = new WP_Query($args); // Pull all the pages into an array $options_pages = array(); - $options_pages_obj = get_pages('sort_column=post_parent,menu_order'); + $options_pages_obj = $query; $options_pages[''] = 'Select a page:'; foreach ($options_pages_obj as $page) { $options_pages[$page->ID] = $page->post_title; diff --git a/inc/ajax.php b/inc/ajax.php index 5a11b76..b95f337 100644 --- a/inc/ajax.php +++ b/inc/ajax.php @@ -8,7 +8,14 @@ $options_categories_obj = get_categories(); - $countsettings = esc_attr( $_REQUEST['count_section'] ); + $countsettings = esc_attr( $_REQUEST['count_section'] ); + $args = array( + 'post_type' => 'glm-panel', + 'cat' => 'panel', + 'posts_per_page' => -1 + ); + $count_service = 0; + $panels= new WP_Query($args); ?>
@@ -19,7 +26,7 @@ diff --git a/inc/blog.php b/inc/blog.php index 6e2c8b5..6d50f02 100644 --- a/inc/blog.php +++ b/inc/blog.php @@ -1,6 +1,6 @@ _x( GLM_BLOG_PLURAL, 'Post Type General Name' ), - 'singular_name' => _x( GLM_BLOG_SINGLE, 'Post Type Singular Name' ), - 'menu_name' => __( GLM_BLOG_PLURAL ), - 'name_admin_bar' => __( GLM_BLOG_PLURAL ), - 'archives' => __( GLM_BLOG_SINGLE . ' Archives' ), - 'parent_item_colon' => __( 'Parent Blog Post:' ), - 'all_items' => __( 'All Blog Posts' ), - 'add_new_item' => __( 'Add New Blog Post' ), + 'name' => _x( GLM_PANEL_PLURAL, 'Post Type General Name' ), + 'singular_name' => _x( GLM_PANEL_SINGLE, 'Post Type Singular Name' ), + 'menu_name' => __( GLM_PANEL_PLURAL ), + 'name_admin_bar' => __( GLM_PANEL_PLURAL ), + 'archives' => __( GLM_PANEL_SINGLE . ' Archives' ), + 'parent_item_colon' => __( 'Parent Panel Post:' ), + 'all_items' => __( 'All Panel Posts' ), + 'add_new_item' => __( 'Add New Panel Post' ), 'add_new' => __( 'Add New' ), - 'new_item' => __( 'New Blog Post' ), + 'new_item' => __( 'New Panel Post' ), 'edit_item' => __( 'Edit Room' ), 'update_item' => __( 'Update Room' ), - 'view_item' => __( 'View Blog Post' ), - 'search_items' => __( 'Search Blog Posts' ), + 'view_item' => __( 'View Panel Post' ), + 'search_items' => __( 'Search Panel Posts' ), 'not_found' => __( 'Not found' ), 'not_found_in_trash' => __( 'Not found in Trash' ), 'featured_image' => __( 'Featured Image' ), @@ -51,21 +51,21 @@ function blogs_custom_post_type() { 'use_featured_image' => __( 'Use as featured image' ), 'insert_into_item' => __( 'Insert into item' ), 'uploaded_to_this_item' => __( 'Uploaded to this item' ), - 'items_list' => __( 'Blog Posts list' ), - 'items_list_navigation' => __( 'Blog Posts list navigation' ), + 'items_list' => __( 'Panel Posts list' ), + 'items_list_navigation' => __( 'Panel Posts list navigation' ), 'filter_items_list' => __( 'Filter items list' ), ); $rewrite = array( - 'slug' => GLM_BLOG_POST_TYPE, + 'slug' => GLM_PANEL_POST_TYPE, 'with_front' => false, 'pages' => false, 'feeds' => false, ); $args = array( - 'label' => __( GLM_BLOG_SINGLE ), - 'description' => __( 'Custom ' . GLM_BLOG_PLURAL ), + 'label' => __( GLM_PANEL_SINGLE ), + 'description' => __( 'Custom ' . GLM_PANEL_PLURAL ), 'labels' => $labels, 'supports' => array( 'title', 'thumbnail', 'revisions', 'editor', 'author'), 'hierarchical' => true, @@ -82,65 +82,65 @@ function blogs_custom_post_type() { 'publicly_queryable' => true, 'rewrite' => $rewrite, 'capability_type' => 'page', - 'register_meta_box_cb' => 'blogs_add_metaboxes', + 'register_meta_box_cb' => 'panels_add_metaboxes', ); - register_post_type( GLM_BLOG_POST_TYPE, $args ); - register_taxonomy_for_object_type( GLM_BLOG_CATEGORY_NAME, GLM_BLOG_POST_TYPE ); + register_post_type( GLM_PANEL_POST_TYPE, $args ); + register_taxonomy_for_object_type( GLM_PANEL_CATEGORY_NAME, GLM_PANEL_POST_TYPE ); } /** - * Blog Posts_add_metaboxes + * Panel Posts_add_metaboxes * * Add the meta fields * * @access public * @return void */ -function blogs_add_metaboxes() { - add_meta_box( 'blogs_water', 'Water', 'blogs_water', GLM_BLOG_POST_TYPE, 'side', 'low' ); - add_meta_box( 'blogs_sewer', 'Sewer', 'blogs_sewer', GLM_BLOG_POST_TYPE, 'side', 'low' ); - add_meta_box( 'blogs_power', 'Power', 'blogs_power', GLM_BLOG_POST_TYPE, 'side', 'low' ); - add_meta_box( 'blogs_loop', 'Loop', 'blogs_loop', GLM_BLOG_POST_TYPE, 'side', 'low' ); -// add_meta_box( 'blogs_tents', 'Tents', 'blogs_tents', GLM_BLOG_POST_TYPE, 'side', 'low' ); +function panels_add_metaboxes() { + add_meta_box( 'panels_water', 'Water', 'panels_water', GLM_PANEL_POST_TYPE, 'side', 'low' ); + add_meta_box( 'panels_sewer', 'Sewer', 'panels_sewer', GLM_PANEL_POST_TYPE, 'side', 'low' ); + add_meta_box( 'panels_power', 'Power', 'panels_power', GLM_PANEL_POST_TYPE, 'side', 'low' ); + add_meta_box( 'panels_loop', 'Loop', 'panels_loop', GLM_PANEL_POST_TYPE, 'side', 'low' ); +// add_meta_box( 'panels_tents', 'Tents', 'panels_tents', GLM_PANEL_POST_TYPE, 'side', 'low' ); } /** - * Blog Posts_water + * Panel Posts_water * * Add field for the water availability * * @access public * @return void */ -function blogs_water() { +function panels_water() { global $post; $checked = ''; // Get the features for the post. - $water = get_post_meta( $post->ID, 'blogs_water', true ); + $water = get_post_meta( $post->ID, 'panels_water', true ); // Output field. if ( 'yes' === $water ) { $checked = 'checked="checked"'; } ?> - /> + /> ID, 'blogs_tents', true ); +// $tents = get_post_meta( $post->ID, 'panels_tents', true ); // // // Output field. // if ( 'yes' === $tents ) { @@ -152,49 +152,49 @@ function blogs_water() { // //} /** - * Blog Posts_loop + * Panel Posts_loop * * Add field for the loop * * @access public * @return void */ -function blogs_loop() { +function panels_loop() { global $post; $value = ''; // Noncename needed to verify where the data originated. - $nonce = wp_create_nonce( 'blogsmeta-meta-noncename' ); - echo ''; + $nonce = wp_create_nonce( 'panelsmeta-meta-noncename' ); + echo ''; // Get the features for the post. - $loop = get_post_meta( $post->ID, 'blogs_loop', true ); + $loop = get_post_meta( $post->ID, 'panels_loop', true ); // Output field. if ( !empty( $loop ) ) { $value = "value=".'"'.$loop .'"'; } ?> - /> + /> '; + $nonce = wp_create_nonce( 'panelsmeta-meta-noncename' ); + echo ''; // Get the features for the post. - $sewer = get_post_meta( $post->ID, 'blogs_sewer', true ); + $sewer = get_post_meta( $post->ID, 'panels_sewer', true ); // Output field. if ( "yes" === $sewer ) { @@ -202,108 +202,108 @@ function blogs_sewer() { } ?> - /> + /> ID, 'blogs_campers', true ); + $campers = get_post_meta( $post->ID, 'panels_campers', true ); // Output field. if ( !empty( $campers ) ) { $value = "value=".'"'.$campers .'"'; } ?> - /> + /> '; + $nonce = wp_create_nonce( 'panelsmeta-meta-noncename' ); + echo ''; // Get the features for the post. - $power = get_post_meta( $post->ID, 'blogs_power', true ); + $power = get_post_meta( $post->ID, 'panels_power', true ); // Output field. if ( !empty( $power ) ) { $value = "value=".'"'.$power .'"'; } ?> - /> + /> ID; } if ( ! current_user_can( 'edit_post', $post->ID ) ) { return $post->ID; } - $water = (isset($_POST['blogs_water']) ? filter_var( $_POST['blogs_water'] ) : '' ); - $sewer = (isset($_POST['blogs_sewer']) ? filter_var( $_POST['blogs_sewer'] ) : '' ); - $power = (isset($_POST['blogs_power']) ? filter_var( $_POST['blogs_power'] ) : '' ); - $loop = (isset($_POST['blogs_loop']) ? filter_var( $_POST['blogs_loop'] ) : '' ); -// $tents = filter_var( $_POST['blogs_tents'] ); - update_post_meta( $post->ID, 'blogs_water', $water ); - update_post_meta( $post->ID, 'blogs_sewer', $sewer ); - update_post_meta( $post->ID, 'blogs_power', $power ); - update_post_meta( $post->ID, 'blogs_loop', $loop ); -// update_post_meta( $post->ID, 'blogs_tents', $tents ); + $water = (isset($_POST['panels_water']) ? filter_var( $_POST['panels_water'] ) : '' ); + $sewer = (isset($_POST['panels_sewer']) ? filter_var( $_POST['panels_sewer'] ) : '' ); + $power = (isset($_POST['panels_power']) ? filter_var( $_POST['panels_power'] ) : '' ); + $loop = (isset($_POST['panels_loop']) ? filter_var( $_POST['panels_loop'] ) : '' ); +// $tents = filter_var( $_POST['panels_tents'] ); + update_post_meta( $post->ID, 'panels_water', $water ); + update_post_meta( $post->ID, 'panels_sewer', $sewer ); + update_post_meta( $post->ID, 'panels_power', $power ); + update_post_meta( $post->ID, 'panels_loop', $loop ); +// update_post_meta( $post->ID, 'panels_tents', $tents ); } /** - * blogs_taxonomies + * panels_taxonomies * * Setup of the Taxonomies for the post type * * @access public * @return void */ -function blogs_taxonomies() { +function panels_taxonomies() { // Experiences $labels = array( - 'name' => _x( GLM_BLOG_CATEGORY_NAME, 'taxonomy general name' ), - 'singular_name' => _x( GLM_BLOG_CATEGORY_NAME, 'taxonomy singular name' ), - 'search_items' => __( 'Search ' . GLM_BLOG_CATEGORY_PLURAL ), - 'all_items' => __( 'All ' . GLM_BLOG_CATEGORY_PLURAL ), - 'parent_item' => __( 'Parent ' . GLM_BLOG_CATEGORY_SINGLE ), - 'parent_item_colon' => __( 'Parent ' . GLM_BLOG_CATEGORY_SINGLE ), - 'edit_item' => __( 'Edit ' . GLM_BLOG_CATEGORY_SINGLE ), - 'update_item' => __( 'Update ' . GLM_BLOG_CATEGORY_SINGLE ), - 'add_new_item' => __( 'Add New ' . GLM_BLOG_CATEGORY_SINGLE ), - 'new_item_name' => __( 'New ' . GLM_BLOG_CATEGORY_SINGLE . ' Name' ), - 'menu_name' => __( 'Site ' . GLM_BLOG_CATEGORY_SINGLE ), + 'name' => _x( GLM_PANEL_CATEGORY_NAME, 'taxonomy general name' ), + 'singular_name' => _x( GLM_PANEL_CATEGORY_NAME, 'taxonomy singular name' ), + 'search_items' => __( 'Search ' . GLM_PANEL_CATEGORY_PLURAL ), + 'all_items' => __( 'All ' . GLM_PANEL_CATEGORY_PLURAL ), + 'parent_item' => __( 'Parent ' . GLM_PANEL_CATEGORY_SINGLE ), + 'parent_item_colon' => __( 'Parent ' . GLM_PANEL_CATEGORY_SINGLE ), + 'edit_item' => __( 'Edit ' . GLM_PANEL_CATEGORY_SINGLE ), + 'update_item' => __( 'Update ' . GLM_PANEL_CATEGORY_SINGLE ), + 'add_new_item' => __( 'Add New ' . GLM_PANEL_CATEGORY_SINGLE ), + 'new_item_name' => __( 'New ' . GLM_PANEL_CATEGORY_SINGLE . ' Name' ), + 'menu_name' => __( 'Site ' . GLM_PANEL_CATEGORY_SINGLE ), ); $capabilities = array( @@ -314,8 +314,8 @@ function blogs_taxonomies() { ); $args = array( - 'label' => __( GLM_BLOG_CATEGORY_PLURAL ), - 'rewrite' => array( 'slug' => GLM_BLOG_CATEGORY_SLUG ), + 'label' => __( GLM_PANEL_CATEGORY_PLURAL ), + 'rewrite' => array( 'slug' => GLM_PANEL_CATEGORY_SLUG ), 'capabilities' => $capabilities, 'public ' => true, 'show_in_quick_edit' => true, @@ -324,21 +324,21 @@ function blogs_taxonomies() { ); register_taxonomy( - GLM_BLOG_CATEGORY_NAME, - GLM_BLOG_POST_TYPE, + GLM_PANEL_CATEGORY_NAME, + GLM_PANEL_POST_TYPE, $args ); } /** - * blogs_taxonomy_filter_restrict_manage_posts + * panels_taxonomy_filter_restrict_manage_posts * * This will setup the Filter for the Custom taxonomies. * * @access public * @return void */ -function blogs_taxonomy_filter_restrict_manage_posts() { +function panels_taxonomy_filter_restrict_manage_posts() { global $typenow; $post_types = get_post_types( array( '_builtin' => false ) ); @@ -352,7 +352,7 @@ function blogs_taxonomy_filter_restrict_manage_posts() { 'show_option_all' => __( 'Show All ' . $tax_obj->label ), 'taxonomy' => $tax_slug, 'name' => $tax_obj->name, - 'orderby' => 'name', + 'orderby' => 'menu_order', 'selected' => ( isset( $_GET[$tax_slug] ) ), 'hierarchical' => $tax_obj->hierarchical, 'show_count' => false, @@ -362,10 +362,10 @@ function blogs_taxonomy_filter_restrict_manage_posts() { } } -add_action( 'restrict_manage_posts', 'blogs_taxonomy_filter_restrict_manage_posts' ); +add_action( 'restrict_manage_posts', 'panels_taxonomy_filter_restrict_manage_posts' ); /** - * Blog Posts_taxonomy_filter_post_type_request + * Panel Posts_taxonomy_filter_post_type_request * * Filter the post request for the Taxonomy Filter * @@ -373,7 +373,7 @@ add_action( 'restrict_manage_posts', 'blogs_taxonomy_filter_restrict_manage_post * @access public * @return void */ -function blogs_taxonomy_filter_post_type_request( $query ) { +function panels_taxonomy_filter_post_type_request( $query ) { global $pagenow, $typenow; if ( 'edit.php' === $pagenow ) { @@ -389,28 +389,28 @@ function blogs_taxonomy_filter_post_type_request( $query ) { } } } -add_filter( 'parse_query', 'blogs_taxonomy_filter_post_type_request' ); -add_action( 'init', 'blogs_custom_post_type' ); -add_action( 'init', 'blogs_taxonomies' ); -add_action( 'save_post', 'blogs_save_meta' ); +add_filter( 'parse_query', 'panels_taxonomy_filter_post_type_request' ); +add_action( 'init', 'panels_custom_post_type' ); +add_action( 'init', 'panels_taxonomies' ); +add_action( 'save_post', 'panels_save_meta' ); /** - * Blog Posts_set_admin_columns + * Panel Posts_set_admin_columns * * Setup of the list columns * * @access public * @return void */ -function blogs_set_admin_columns() { - add_filter( 'manage_edit-blogs_columns', 'blogs_admin_edit_columns' ); - add_action( 'manage_blogs_posts_custom_column', 'blogs_admin_custom_columns' ); +function panels_set_admin_columns() { + add_filter( 'manage_edit-panels_columns', 'panels_admin_edit_columns' ); + add_action( 'manage_panels_posts_custom_column', 'panels_admin_custom_columns' ); } -add_action( 'admin_init', 'blogs_set_admin_columns' ); +add_action( 'admin_init', 'panels_set_admin_columns' ); /** - * Blog Posts_admin_edit_columns + * Panel Posts_admin_edit_columns * * Setup of the edit columns. This will create the headers for each column. * @@ -418,17 +418,17 @@ add_action( 'admin_init', 'blogs_set_admin_columns' ); * @access public * @return void */ -function blogs_admin_edit_columns( $columns ) { +function panels_admin_edit_columns( $columns ) { $columns = array( 'cb' => '', - 'title' => GLM_BLOG_SINGLE . ' Title', - 'blogs_col_cat' => GLM_BLOG_CATEGORY_SINGLE, + 'title' => GLM_PANEL_SINGLE . ' Title', + 'panels_col_cat' => GLM_PANEL_CATEGORY_SINGLE, ); return $columns; } /** - * Blog Posts_admin_custom_columns + * Panel Posts_admin_custom_columns * * This will generate the column data for eaoch record. * @@ -436,12 +436,12 @@ function blogs_admin_edit_columns( $columns ) { * @access public * @return void */ -function blogs_admin_custom_columns( $column ) { +function panels_admin_custom_columns( $column ) { global $post; switch ( $column ) { - case 'blogs_col_cat': - $product_cats = get_the_terms( $post->ID, 'blogs_category' ); + case 'panels_col_cat': + $product_cats = get_the_terms( $post->ID, 'panels_category' ); $product_cats_html = array(); if ( $product_cats ) { foreach ( $product_cats as $product_cat ) { @@ -452,8 +452,8 @@ function blogs_admin_custom_columns( $column ) { _e( 'None', 'themeforce' ); } break; - case 'blogs_col_tag': - $product_tags = get_the_terms( $post->ID, 'blogs_tag' ); + case 'panels_col_tag': + $product_tags = get_the_terms( $post->ID, 'panels_tag' ); $product_tags_html = array(); if ( $product_tags ) { foreach ( $product_tags as $product_tag ) { @@ -468,7 +468,7 @@ function blogs_admin_custom_columns( $column ) { } /** - * Blog Posts_shortcode + * Panel Posts_shortcode * * Add shortcode function. This will call the correct function based on the * front end search. @@ -477,19 +477,19 @@ function blogs_admin_custom_columns( $column ) { * @access public * @return void */ -function blogs_shortcode( $atts ) { +function panels_shortcode( $atts ) { extract( shortcode_atts( array( 'limit' => '10' ), $atts ) ); ob_start(); if ( isset( $atts['cat']) ) { - if ( $prod_experience = get_term_by( 'slug', $atts['cat'], GLM_BLOG_CATEGORY_NAME ) ) { - if ( !isset($_REQUEST[ GLM_BLOG_CATEGORY_NAME ] )) { - $_REQUEST[ GLM_BLOG_CATEGORY_NAME ] = $prod_experience->term_id; + if ( $prod_experience = get_term_by( 'slug', $atts['cat'], GLM_PANEL_CATEGORY_NAME ) ) { + if ( !isset($_REQUEST[ GLM_PANEL_CATEGORY_NAME ] )) { + $_REQUEST[ GLM_PANEL_CATEGORY_NAME ] = $prod_experience->term_id; } $cat_id = $prod_experience->term_id; } } - $term = get_term_by( "id", $_REQUEST[ GLM_BLOG_CATEGORY_NAME ],"blogs_category" ); + $term = get_term_by( "id", $_REQUEST[ GLM_PANEL_CATEGORY_NAME ],"panels_category" ); $name = $term->name; if ( !$name ) { $name = "ALL PRODUCTS"; @@ -497,7 +497,7 @@ function blogs_shortcode( $atts ) { global $wp; echo '
'; - echo blogs_get_terms_dropdown( $cat_id ); + echo panels_get_terms_dropdown( $cat_id ); echo '
'; if ( $product_id = filter_var( $_REQUEST['product'], FILTER_VALIDATE_INT ) ) { - blogs_show_product( $product_id ); + panels_show_product( $product_id ); } else if ( $cat_id = filter_var( $_REQUEST['category'], FILTER_VALIDATE_INT ) ) { - blogs_list_categories( $cat_id ); + panels_list_categories( $cat_id ); } else if ( !$catid_id && !$product_id ) { $text_query = filter_var( $_REQUEST['tsearch'], FILTER_SANITIZE_STRING ); @@ -519,8 +519,8 @@ function blogs_shortcode( $atts ) { } else { setcookie("search", "null",time()+2, "/" ); } - blogs_list_products( $text_query ); - blogs_list_categories(); + panels_list_products( $text_query ); + panels_list_categories(); } $output = ob_get_contents(); @@ -529,26 +529,26 @@ function blogs_shortcode( $atts ) { } /** - * Blog Posts_get_terms_dropdown + * Panel Posts_get_terms_dropdown * * Generate the taxonomy drop down select * * @access public * @return void */ -function blogs_get_terms_dropdown( $cat_id ) { +function panels_get_terms_dropdown( $cat_id ) { - $taxonomy_name = GLM_BLOG_CATEGORY_NAME; + $taxonomy_name = GLM_PANEL_CATEGORY_NAME; if ( $cat_id ) { - $main = get_term( $cat_id, GLM_BLOG_CATEGORY_NAME ); + $main = get_term( $cat_id, GLM_PANEL_CATEGORY_NAME ); $cats_child = get_term_children( $cat_id, $taxonomy_name ); - $output =""; foreach ( $cats_child as $cat ) { $output .= ''; } $output .=""; @@ -557,33 +557,33 @@ function blogs_get_terms_dropdown( $cat_id ) { $parent_terms = get_terms( $taxonomy_name, array('parent' => 0, 'orderby' => 'name', 'hide_empty' => false )); $terms = get_terms( $taxonomy_name, array('orderby' => 'name', 'hide_empty' => false )); - $output =""; // Get parent categories. foreach ( $parent_terms as $parent ) { // Get children of each category. $child_terms = get_terms( $taxonomy_name, array('parent'=> $parent->term_id, 'child_of' => $parent->term_id, 'orderby' => 'name', 'hide_empty' => false)); $output .= ''; foreach ($child_terms as $child ) { $grandchildren = get_terms( $taxonomy_name, array('parent'=> $child->term_id, 'child_of' => $child->term_id, 'orderby' => 'name', 'hide_empty' => false )); $output .= ''; foreach ( $grandchildren as $grand_child) { $great_grandchildren = get_terms( $taxonomy_name, array( 'parent'=> $grand_child->term_id, 'child_of' => $grand_child->term_id, 'orderby' => 'name', 'hide_empty' => false )); $output .= ''; foreach ( $great_grandchildren as $great_grandchild ) { $output .= ''; @@ -597,33 +597,33 @@ function blogs_get_terms_dropdown( $cat_id ) { /** - * Blog Posts_list_products + * Panel Posts_list_products * * Create a list of products. * * @access public * @return void */ -function blogs_list_products( $text_query ) { +function panels_list_products( $text_query ) { global $wpdb, $wp; - $cat = get_term( $cat_id, GLM_BLOG_CATEGORY_NAME ); + $cat = get_term( $cat_id, GLM_PANEL_CATEGORY_NAME ); $args = array( 'posts_per_page' => -1, - 'post_type' => GLM_BLOG_POST_TYPE, + 'post_type' => GLM_PANEL_POST_TYPE, 's' => $text_query, ); - $blogs_category = ( isset( $_REQUEST[ GLM_BLOG_CATEGORY_NAME ] ) ) - ? filter_var( $_REQUEST[ GLM_BLOG_CATEGORY_NAME ] ) + $panels_category = ( isset( $_REQUEST[ GLM_PANEL_CATEGORY_NAME ] ) ) + ? filter_var( $_REQUEST[ GLM_PANEL_CATEGORY_NAME ] ) : false; - if ( $blogs_category ) { + if ( $panels_category ) { $args['tax_query'] = array( 'relation' => 'AND', ); $args['tax_query'][] = array( - 'taxonomy' => GLM_BLOG_CATEGORY_NAME, + 'taxonomy' => GLM_PANEL_CATEGORY_NAME, 'field' => 'id', - 'terms' => $blogs_category, + 'terms' => $panels_category, ); } @@ -633,14 +633,14 @@ function blogs_list_products( $text_query ) { $iterator = 1; foreach ( $products as $product ) { - $product_terms = wp_get_post_terms( $product->ID, GLM_BLOG_CATEGORY_NAME, 'name' ); + $product_terms = wp_get_post_terms( $product->ID, GLM_PANEL_CATEGORY_NAME, 'name' ); $p_term = $product_terms[0]; $product->term = $p_term->name; $product->end = false; if ( $iterator == $total_products ) { $product->end = true; } - $cat->href = "?blogs_category="; + $cat->href = "?panels_category="; $product->href = $current_url . ( ( strpos( $current_url, '?' ) ) ? '&' : '?' ) . "product=" . $product->ID; @@ -651,7 +651,7 @@ function blogs_list_products( $text_query ) { return; } /** - * blogs_list_categories + * panels_list_categories * * Create a list of categories. * @@ -659,10 +659,10 @@ function blogs_list_products( $text_query ) { * @access public * @return void */ -function blogs_list_categories( $cat_id = null ) { +function panels_list_categories( $cat_id = null ) { global $wpdb, $wp; - $taxonomy = GLM_BLOG_CATEGORY_NAME; + $taxonomy = GLM_PANEL_CATEGORY_NAME; $args = array( 'hide_empty' => false, 'pad_counts' => true @@ -686,7 +686,7 @@ function blogs_list_categories( $cat_id = null ) { } $term->href .= //$current_url // ( ( strpos( $current_url, '?' ) ) ? '&' : '?' ). - "?blogs_category=" . $term->term_id; + "?panels_category=" . $term->term_id; ++$iterator; } @@ -695,7 +695,7 @@ function blogs_list_categories( $cat_id = null ) { } /** - * Blog Posts_show_product + * Panel Posts_show_product * * Create a product detail page. * @@ -703,14 +703,14 @@ function blogs_list_categories( $cat_id = null ) { * @access public * @return void */ -function blogs_show_product( $prod_id ) { +function panels_show_product( $prod_id ) { global $wpdb, $wp; $product = get_post( $prod_id ); include 'views/product_detail.php'; return; } /** - * Blog Posts_show_category + * Panel Posts_show_category * * Create a product detail page. * @@ -718,10 +718,10 @@ function blogs_show_product( $prod_id ) { * @access public * @return void */ -function blogs_show_category( $cat_id ) { +function panels_show_category( $cat_id ) { global $wpdb, $wp; $term = get_terms( - GLM_BLOG_CATEGORY_NAME, + GLM_PANEL_CATEGORY_NAME, array( 'child_of' => $cat_id, 'hide_empty' => true, @@ -733,6 +733,6 @@ function blogs_show_category( $cat_id ) { include 'views/category_detail.php'; return; } -add_shortcode( 'blogs', 'blogs_shortcode' ); +add_shortcode( 'panels', 'panels_shortcode' ); diff --git a/inc/parallax.php b/inc/parallax.php new file mode 100644 index 0000000..3048c24 --- /dev/null +++ b/inc/parallax.php @@ -0,0 +1,738 @@ + + * Author URI: + * License: GPLv2 + **/ + +define( 'GLM_PARALLAX_POST_POST_TYPE', 'glm-parallax' ); +define( 'GLM_PARALLAX_POST_SINGLE', 'Parallax Post' ); +define( 'GLM_PARALLAX_POST_PLURAL', 'Parallax Posts' ); +define( 'GLM_PARALLAX_POST_CATEGORY_NAME', 'parallax_posts_category' ); +define( 'GLM_PARALLAX_POST_CATEGORY_SLUG', 'parallax_posts-category' ); +define( 'GLM_PARALLAX_POST_CATEGORY_SINGLE', 'Type' ); +define( 'GLM_PARALLAX_POST_CATEGORY_PLURAL', 'Parallax Post Types' ); + +// Register Custom Post Type. +/** + * Parallax Posts_custom_post_type + * + * Setup of the Wordpress Custom Post Type + * + * @access public + * @return void + */ +function parallax_posts_custom_post_type() { + + $labels = array( + 'name' => _x( GLM_PARALLAX_POST_PLURAL, 'Post Type General Name' ), + 'singular_name' => _x( GLM_PARALLAX_POST_SINGLE, 'Post Type Singular Name' ), + 'menu_name' => __( GLM_PARALLAX_POST_PLURAL ), + 'name_admin_bar' => __( GLM_PARALLAX_POST_PLURAL ), + 'archives' => __( GLM_PARALLAX_POST_SINGLE . ' Archives' ), + 'parent_item_colon' => __( 'Parent Parallax Post:' ), + 'all_items' => __( 'All Parallax Posts' ), + 'add_new_item' => __( 'Add New Parallax Post' ), + 'add_new' => __( 'Add New Parallax Post' ), + 'new_item' => __( 'New Parallax Post' ), + 'edit_item' => __( 'Edit Parallax Post' ), + 'update_item' => __( 'Update Parallax Post' ), + 'view_item' => __( 'View Parallax Post' ), + 'search_items' => __( 'Search Parallax Post' ), + 'not_found' => __( 'Not found' ), + 'not_found_in_trash' => __( 'Not found in Trash' ), + 'featured_image' => __( 'Featured Image' ), + 'set_featured_image' => __( 'Set featured image' ), + 'remove_featured_image' => __( 'Remove featured image' ), + 'use_featured_image' => __( 'Use as featured image' ), + 'insert_into_item' => __( 'Insert into item' ), + 'uploaded_to_this_item' => __( 'Uploaded to this item' ), + 'items_list' => __( 'Parallax Posts list' ), + 'items_list_navigation' => __( 'Parallax Posts list navigation' ), + 'filter_items_list' => __( 'Filter items list' ), + ); + + $rewrite = array( + 'slug' => GLM_PARALLAX_POST_POST_TYPE , + 'with_front' => false, + 'pages' => false, + 'feeds' => false, + ); + + $args = array( + 'label' => __( GLM_PARALLAX_POST_SINGLE ), + 'description' => __( 'Custom ' . GLM_PARALLAX_POST_PLURAL ), + 'labels' => $labels, + 'supports' => array( 'title', 'thumbnail', 'revisions', 'editor', 'author','page-attributes'), + 'hierarchical' => true, + 'public' => true, + 'show_ui' => true, + 'show_in_menu' => true, + 'menu_position' => 5, + 'menu_icon' => 'dashicons-images-alt', + 'show_in_admin_bar' => true, + 'show_in_nav_menus' => true, + 'can_export' => true, + 'has_archive' => true, + 'exclude_from_search' => false, + 'publicly_queryable' => true, + 'rewrite' => $rewrite, + 'capability_type' => 'page', + 'register_meta_box_cb' => 'parallax_posts_add_metaboxes', + ); + + register_post_type( GLM_PARALLAX_POST_POST_TYPE , $args ); + register_taxonomy_for_object_type( GLM_PARALLAX_POST_CATEGORY_NAME, GLM_PARALLAX_POST_POST_TYPE ); +} + +/** + * Parallax Posts_add_metaboxes + * + * Add the meta fields + * + * @access public + * @return void + */ +function parallax_posts_add_metaboxes() { + add_meta_box( 'parallax_posts_water', 'Water', 'parallax_posts_water', GLM_PARALLAX_POST_POST_TYPE , 'side', 'low' ); + add_meta_box( 'parallax_posts_sewer', 'Sewer', 'parallax_posts_sewer', GLM_PARALLAX_POST_POST_TYPE , 'side', 'low' ); + add_meta_box( 'parallax_posts_power', 'Power', 'parallax_posts_power', GLM_PARALLAX_POST_POST_TYPE , 'side', 'low' ); + add_meta_box( 'parallax_posts_loop', 'Loop', 'parallax_posts_loop', GLM_PARALLAX_POST_POST_TYPE , 'side', 'low' ); +// add_meta_box( 'parallax_posts_tents', 'Tents', 'parallax_posts_tents', GLM_PARALLAX_POST_POST_TYPE , 'side', 'low' ); +} + +/** + * Parallax Posts_water + * + * Add field for the water availability + * + * @access public + * @return void + */ +function parallax_posts_water() { + global $post; + $checked = ''; + // Get the features for the post. + $water = get_post_meta( $post->ID, 'parallax_posts_water', true ); + + // Output field. + if ( 'yes' === $water ) { + $checked = 'checked="checked"'; + } + ?> + /> + ID, 'parallax_posts_tents', true ); +// +// // Output field. +// if ( 'yes' === $tents ) { +// $checked = 'checked="checked"'; +// } +// + + +// +//} +/** + * Parallax Posts_loop + * + * Add field for the loop + * + * @access public + * @return void + */ +function parallax_posts_loop() { + global $post; + $value = ''; + // Noncename needed to verify where the data originated. + $nonce = wp_create_nonce( 'parallax_postsmeta-meta-noncename' ); + echo ''; + + // Get the features for the post. + $loop = get_post_meta( $post->ID, 'parallax_posts_loop', true ); + // Output field. + if ( !empty( $loop ) ) { + $value = "value=".'"'.$loop .'"'; + } + + ?> + /> + '; + // Get the features for the post. + $sewer = get_post_meta( $post->ID, 'parallax_posts_sewer', true ); + + // Output field. + if ( "yes" === $sewer ) { + $checked = 'checked="checked"'; + } + + ?> + /> + ID, 'parallax_posts_campers', true ); + + // Output field. + if ( !empty( $campers ) ) { + $value = "value=".'"'.$campers .'"'; + } + ?> + /> + '; + + // Get the features for the post. + $power = get_post_meta( $post->ID, 'parallax_posts_power', true ); + // Output field. + if ( !empty( $power ) ) { + $value = "value=".'"'.$power .'"'; + } + + ?> + /> + ID; + } + if ( ! current_user_can( 'edit_post', $post->ID ) ) { + return $post->ID; + } + $water = (isset($_POST['parallax_posts_water']) ? filter_var( $_POST['parallax_posts_water'] ) : '' ); + $sewer = (isset($_POST['parallax_posts_sewer']) ? filter_var( $_POST['parallax_posts_sewer'] ) : '' ); + $power = (isset($_POST['parallax_posts_power']) ? filter_var( $_POST['parallax_posts_power'] ) : '' ); + $loop = (isset($_POST['parallax_posts_loop']) ? filter_var( $_POST['parallax_posts_loop'] ) : '' ); +// $tents = filter_var( $_POST['parallax_posts_tents'] ); + update_post_meta( $post->ID, 'parallax_posts_water', $water ); + update_post_meta( $post->ID, 'parallax_posts_sewer', $sewer ); + update_post_meta( $post->ID, 'parallax_posts_power', $power ); + update_post_meta( $post->ID, 'parallax_posts_loop', $loop ); +// update_post_meta( $post->ID, 'parallax_posts_tents', $tents ); +} +/** + * parallax_posts_taxonomies + * + * Setup of the Taxonomies for the post type + * + * @access public + * @return void + */ +function parallax_posts_taxonomies() { + + // Experiences + $labels = array( + 'name' => _x( GLM_PARALLAX_POST_CATEGORY_NAME, 'taxonomy general name' ), + 'singular_name' => _x( GLM_PARALLAX_POST_CATEGORY_NAME, 'taxonomy singular name' ), + 'search_items' => __( 'Search ' . GLM_PARALLAX_POST_CATEGORY_PLURAL ), + 'all_items' => __( 'All ' . GLM_PARALLAX_POST_CATEGORY_PLURAL ), + 'parent_item' => __( 'Parent ' . GLM_PARALLAX_POST_CATEGORY_SINGLE ), + 'parent_item_colon' => __( 'Parent ' . GLM_PARALLAX_POST_CATEGORY_SINGLE ), + 'edit_item' => __( 'Edit ' . GLM_PARALLAX_POST_CATEGORY_SINGLE ), + 'update_item' => __( 'Update ' . GLM_PARALLAX_POST_CATEGORY_SINGLE ), + 'add_new_item' => __( 'Add New ' . GLM_PARALLAX_POST_CATEGORY_SINGLE ), + 'new_item_name' => __( 'New ' . GLM_PARALLAX_POST_CATEGORY_SINGLE . ' Name' ), + 'menu_name' => __( 'Site ' . GLM_PARALLAX_POST_CATEGORY_SINGLE ), + ); + + $capabilities = array( + 'manage_terms' => 'manage_categories', + 'edit_terms' => 'manage_categories', + 'delete_terms' => 'manage_categories', + 'assign_terms' => 'edit_posts', + ); + + $args = array( + 'label' => __( GLM_PARALLAX_POST_CATEGORY_PLURAL ), + 'rewrite' => array( 'slug' => GLM_PARALLAX_POST_CATEGORY_SLUG ), + 'capabilities' => $capabilities, + 'public ' => true, + 'show_in_quick_edit' => true, + 'show_in_admin_column' => true, + 'hierarchical' => true + ); + + register_taxonomy( + GLM_PARALLAX_POST_CATEGORY_NAME, + GLM_PARALLAX_POST_POST_TYPE , + $args + ); +} + +/** + * parallax_posts_taxonomy_filter_restrict_manage_posts + * + * This will setup the Filter for the Custom taxonomies. + * + * @access public + * @return void + */ +function parallax_posts_taxonomy_filter_restrict_manage_posts() { + global $typenow; + + $post_types = get_post_types( array( '_builtin' => false ) ); + + if ( in_array( $typenow, $post_types ) ) { + $filters = get_object_taxonomies( $typenow ); + + foreach ( $filters as $tax_slug ) { + $tax_obj = get_taxonomy( $tax_slug ); + wp_dropdown_categories( array( + 'show_option_all' => __( 'Show All ' . $tax_obj->label ), + 'taxonomy' => $tax_slug, + 'name' => $tax_obj->name, + 'orderby' => 'menu_order', + 'selected' => ( isset( $_GET[$tax_slug] ) ), + 'hierarchical' => $tax_obj->hierarchical, + 'show_count' => false, + 'hide_empty' => true, + ) ); + } + } +} + +add_action( 'restrict_manage_posts', 'parallax_posts_taxonomy_filter_restrict_manage_posts' ); + +/** + * Parallax Posts_taxonomy_filter_post_type_request + * + * Filter the post request for the Taxonomy Filter + * + * @param mixed $query + * @access public + * @return void + */ +function parallax_posts_taxonomy_filter_post_type_request( $query ) { + global $pagenow, $typenow; + + if ( 'edit.php' === $pagenow ) { + $filters = get_object_taxonomies( $typenow ); + foreach ( $filters as $tax_slug ) { + $var = &$query->query_vars[ $tax_slug ]; + + if ( isset( $var ) ) { + $term = get_term_by( 'id', $var, $tax_slug ); + + $var = $term->slug; + } + } + } +} +add_filter( 'parse_query', 'parallax_posts_taxonomy_filter_post_type_request' ); +add_action( 'init', 'parallax_posts_custom_post_type' ); +add_action( 'init', 'parallax_posts_taxonomies' ); +add_action( 'save_post', 'parallax_posts_save_meta' ); + +/** + * Parallax Posts_set_admin_columns + * + * Setup of the list columns + * + * @access public + * @return void + */ +function parallax_posts_set_admin_columns() { + add_filter( 'manage_edit-parallax_posts_columns', 'parallax_posts_admin_edit_columns' ); + add_action( 'manage_parallax_posts_posts_custom_column', 'parallax_posts_admin_custom_columns' ); +} + +add_action( 'admin_init', 'parallax_posts_set_admin_columns' ); + +/** + * Parallax Posts_admin_edit_columns + * + * Setup of the edit columns. This will create the headers for each column. + * + * @param mixed $columns + * @access public + * @return void + */ +function parallax_posts_admin_edit_columns( $columns ) { + $columns = array( + 'cb' => '', + 'title' => GLM_PARALLAX_POST_SINGLE . ' Title', + 'parallax_posts_col_cat' => GLM_PARALLAX_POST_CATEGORY_SINGLE, + ); + return $columns; +} + +/** + * Parallax Posts_admin_custom_columns + * + * This will generate the column data for eaoch record. + * + * @param mixed $column + * @access public + * @return void + */ +function parallax_posts_admin_custom_columns( $column ) { + global $post; + + switch ( $column ) { + case 'parallax_posts_col_cat': + $product_cats = get_the_terms( $post->ID, 'parallax_posts_category' ); + $product_cats_html = array(); + if ( $product_cats ) { + foreach ( $product_cats as $product_cat ) { + array_push( $product_cats_html, $product_cat->name ); + } + echo implode( $product_cats_html, ', ' ); + } else { + _e( 'None', 'themeforce' ); + } + break; + case 'parallax_posts_col_tag': + $product_tags = get_the_terms( $post->ID, 'parallax_posts_tag' ); + $product_tags_html = array(); + if ( $product_tags ) { + foreach ( $product_tags as $product_tag ) { + array_push( $product_tags_html, $product_tag->name ); + } + echo implode( $product_tags_html, ', ' ); + } else { + _e( 'None', 'themeforce' ); + } + break; + } +} + +/** + * Parallax Posts_shortcode + * + * Add shortcode function. This will call the correct function based on the + * front end search. + * + * @param mixed $atts + * @access public + * @return void + */ +function parallax_posts_shortcode( $atts ) { + extract( shortcode_atts( array( 'limit' => '10' ), $atts ) ); + ob_start(); + + if ( isset( $atts['cat']) ) { + if ( $prod_experience = get_term_by( 'slug', $atts['cat'], GLM_PARALLAX_POST_CATEGORY_NAME ) ) { + if ( !isset($_REQUEST[ GLM_PARALLAX_POST_CATEGORY_NAME ] )) { + $_REQUEST[ GLM_PARALLAX_POST_CATEGORY_NAME ] = $prod_experience->term_id; + } + $cat_id = $prod_experience->term_id; + } + } + $term = get_term_by( "id", $_REQUEST[ GLM_PARALLAX_POST_CATEGORY_NAME ],"parallax_posts_category" ); + $name = $term->name; + if ( !$name ) { + $name = "ALL PRODUCTS"; + } + global $wp; + echo '
+ Search Products
'; + echo parallax_posts_get_terms_dropdown( $cat_id ); + echo '
'; + + if ( $product_id = filter_var( $_REQUEST['product'], FILTER_VALIDATE_INT ) ) { + parallax_posts_show_product( $product_id ); + } else if ( $cat_id = filter_var( $_REQUEST['category'], FILTER_VALIDATE_INT ) ) { + parallax_posts_list_categories( $cat_id ); + } else if ( !$catid_id && !$product_id ) { + + $text_query = filter_var( $_REQUEST['tsearch'], FILTER_SANITIZE_STRING ); + + if (isset( $_REQUEST[ 'tsearch' ] ) ) { + setcookie("search", "true",time()+2, "/" ); + } else { + setcookie("search", "null",time()+2, "/" ); + } + parallax_posts_list_products( $text_query ); + parallax_posts_list_categories(); + } + + $output = ob_get_contents(); + ob_end_clean(); + return $output; +} + +/** + * Parallax Posts_get_terms_dropdown + * + * Generate the taxonomy drop down select + * + * @access public + * @return void + */ +function parallax_posts_get_terms_dropdown( $cat_id ) { + + $taxonomy_name = GLM_PARALLAX_POST_CATEGORY_NAME; + if ( $cat_id ) { + $main = get_term( $cat_id, GLM_PARALLAX_POST_CATEGORY_NAME ); + $cats_child = get_term_children( $cat_id, $taxonomy_name ); + $output =""; + } else { + + $parent_terms = get_terms( $taxonomy_name, array('parent' => 0, 'orderby' => 'name', 'hide_empty' => false )); + $terms = get_terms( $taxonomy_name, array('orderby' => 'name', 'hide_empty' => false )); + + $output ="'; } + return $output; +} + + +/** + * Parallax Posts_list_products + * + * Create a list of products. + * + * @access public + * @return void + */ +function parallax_posts_list_products( $text_query ) { + global $wpdb, $wp; + $cat = get_term( $cat_id, GLM_PARALLAX_POST_CATEGORY_NAME ); + $args = array( + 'posts_per_page' => -1, + 'post_type' => GLM_PARALLAX_POST_POST_TYPE , + 's' => $text_query, + ); + $parallax_posts_category = ( isset( $_REQUEST[ GLM_PARALLAX_POST_CATEGORY_NAME ] ) ) + ? filter_var( $_REQUEST[ GLM_PARALLAX_POST_CATEGORY_NAME ] ) + : false; + + if ( $parallax_posts_category ) { + $args['tax_query'] = array( + 'relation' => 'AND', + ); + $args['tax_query'][] = array( + 'taxonomy' => GLM_PARALLAX_POST_CATEGORY_NAME, + 'field' => 'id', + 'terms' => $parallax_posts_category, + ); + } + + $products = get_posts( $args ); + $total_products = count( $products ); + $current_url = esc_url( add_query_arg( $wp->query_string, '', home_url( $wp->request ) ) ); + $iterator = 1; + + foreach ( $products as $product ) { + $product_terms = wp_get_post_terms( $product->ID, GLM_PARALLAX_POST_CATEGORY_NAME, 'name' ); + $p_term = $product_terms[0]; + $product->term = $p_term->name; + $product->end = false; + if ( $iterator == $total_products ) { + $product->end = true; + } + $cat->href = "?parallax_posts_category="; + $product->href = $current_url + . ( ( strpos( $current_url, '?' ) ) ? '&' : '?' ) + . "product=" . $product->ID; + ++$iterator; + } + + include 'views/list_products.php'; + return; +} +/** + * parallax_posts_list_categories + * + * Create a list of categories. + * + * @param bool $cat_id + * @access public + * @return void + */ +function parallax_posts_list_categories( $cat_id = null ) { + global $wpdb, $wp; + + $taxonomy = GLM_PARALLAX_POST_CATEGORY_NAME; + $args = array( + 'hide_empty' => false, + 'pad_counts' => true + ); + if ( $cat_id ) { + $args['child_of'] = $cat_id; + } else { + $args['parent'] = 0; + } + $taxonomy_terms = get_terms( $taxonomy, $args ); + + + $total_terms = count( $taxonomy_terms ); + $current_url = esc_url( add_query_arg( $wp->query_string, '', home_url( $wp->request ) ) ); + $iterator = 1; + + foreach ( $taxonomy_terms as $term ) { + $term->end = false; + if ( $iterator === $total_terms) { + $term->end = true; + } + $term->href .= //$current_url +// ( ( strpos( $current_url, '?' ) ) ? '&' : '?' ). + "?parallax_posts_category=" . $term->term_id; + ++$iterator; + } + + include 'views/list_categories.php'; + return; +} + +/** + * Parallax Posts_show_product + * + * Create a product detail page. + * + * @param mixed $prod_id + * @access public + * @return void + */ +function parallax_posts_show_product( $prod_id ) { + global $wpdb, $wp; + $product = get_post( $prod_id ); + include 'views/product_detail.php'; + return; +} +/** + * Parallax Posts_show_category + * + * Create a product detail page. + * + * @param mixed $cat_id + * @access public + * @return void + */ +function parallax_posts_show_category( $cat_id ) { + global $wpdb, $wp; + $term = get_terms( + GLM_PARALLAX_POST_CATEGORY_NAME, + array( + 'child_of' => $cat_id, + 'hide_empty' => true, + //'parent' => $catid_id, + //'hierarchical' => false + ) + ); + + include 'views/category_detail.php'; + return; +} +add_shortcode( 'parallax_posts', 'parallax_posts_shortcode' ); + + diff --git a/inc/rooms.php b/inc/rooms.php index 186b9e4..2d89af7 100644 --- a/inc/rooms.php +++ b/inc/rooms.php @@ -352,7 +352,7 @@ function rooms_taxonomy_filter_restrict_manage_posts() { 'show_option_all' => __( 'Show All ' . $tax_obj->label ), 'taxonomy' => $tax_slug, 'name' => $tax_obj->name, - 'orderby' => 'name', + 'orderby' => 'menu_order', 'selected' => ( isset( $_GET[$tax_slug] ) ), 'hierarchical' => $tax_obj->hierarchical, 'show_count' => false, diff --git a/index-parallax.php b/index-parallax.php index 0f155a8..3f627e8 100644 --- a/index-parallax.php +++ b/index-parallax.php @@ -35,7 +35,13 @@
'glm-panel', + 'cat' => 'panel', + 'posts_per_page' => -1 + ); + $count_service = 0; + $query = new WP_Query($args); while ( $query->have_posts() ) : $query->the_post(); ?> $category, 'posts_per_page' => 3 ); diff --git a/layouts/portfolio-section.php b/layouts/portfolio-section.php index 77f81fa..5057139 100644 --- a/layouts/portfolio-section.php +++ b/layouts/portfolio-section.php @@ -9,11 +9,13 @@
'glm-parallax', 'cat' => $category, 'posts_per_page' => -1 ); - $query = new WP_Query($args); + $query = new WP_Query($args); + print_r($query); if($query->have_posts()): $i = 0; while($query->have_posts()): $query->the_post(); diff --git a/layouts/service-section.php b/layouts/service-section.php index 850545a..7ae1c91 100644 --- a/layouts/service-section.php +++ b/layouts/service-section.php @@ -9,8 +9,9 @@
$category, - 'posts_per_page' => -1 + 'post_type' => 'glm-parallax', + 'cat' => 'parallax', + 'posts_per_page' => -1 ); $count_service = 0; $query = new WP_Query($args); diff --git a/layouts/team-section.php b/layouts/team-section.php index c7ff0d0..b3dedb9 100644 --- a/layouts/team-section.php +++ b/layouts/team-section.php @@ -9,8 +9,10 @@
'glm-parallax', 'cat' => $category, - 'posts_per_page' => -1 + 'posts_per_page' => -1, + 'orderby' => 'menu_order' ); $query = new WP_Query($args); if($query->have_posts()): ?> @@ -43,6 +45,7 @@ 'glm-parallax', 'cat' => $category, 'posts_per_page' => -1 ); diff --git a/layouts/testimonial-section.php b/layouts/testimonial-section.php index 6f1f3c4..4819536 100644 --- a/layouts/testimonial-section.php +++ b/layouts/testimonial-section.php @@ -9,6 +9,7 @@
'glm-parallax', 'cat' => $category, 'posts_per_page' => -1 );