Custom folder for wordpress page templates
In WordPress 3.4, themes can now place page templates inside a subdirectory of their theme. via an API called WP_theme. Read more here: http://core.trac.wordpress.org/ticket/20103
In WordPress 3.4, themes can now place page templates inside a subdirectory of their theme. via an API called WP_theme. Read more here: http://core.trac.wordpress.org/ticket/20103
You have a few issues in your function. first, $data contains the post type, so we look there. your if statement won’t work like that, you have to check conditions individually. and to find the matching page, just query by title for your page with WP_Query: function find_parent_for_cpt( $data ) { if ( $data[‘post_type’] != … Read more
Probably the easiest thing to do would be to create a custom menu. That would give you control over the order that the pages appear in.
Its not good way to edit .htaccess for wordpress url rewriting (only for main urls settings from admin panel) You found your response here : API basic url rewriting or The Rewrite API: Post Types & Taxonomies An example : add_action( ‘init’, ‘rewrite_rule’ ); function rewrite_rule() { global $wp,$wp_rewrite; // Remember to flush the rules … Read more
This should work by putting the good IDs. The paged attribute is useless here as you’ll always show the same posts. <div id=”main_posts”> <?php $temp = $wp_query; $wp_query= null; $wp_query = new WP_Query(); $wp_query->query(array( ‘showposts’ => 3, //’paged’ => $paged, ‘post_type’ => ‘page’, ‘post__in’ => array(1, 2, 3) // Your post IDs )); ?> <?php … Read more
$query = new WP_Query( ‘post_type=page’ ); as seen at codex http://codex.wordpress.org/Class_Reference/WP_Query#Type_.26_Status_Parameters
I found the answer on WordPress Forum: http://wordpress.org/support/topic/add-backend-page-without-menu-item#post-2135050 It requires add_submenu_page() with slug = null (first argument). In WordPress documentation it’s marked as ‘required’ so it looks like it’s required but can be null.
You can indeed query on post metadata, see Custom Field Parametersfor WP_Query in Codex. I would recommend against using a custom table. EDIT – Here’s an example query for all resorts with meta key vertical_feet between 2000 and 3000: $args = array( ‘post_type’ => ‘resort’, ‘posts_per_page’ => -1, ‘meta_query’ => array( array( ‘key’ => ‘vertical_feet’, … Read more
The short answer is that your pages are stored in a database. So they are likely to be safe. It sounds like something else is broken with your site … please can you cut n paste any error message here What were you doing to break it? 1. If you recently updated a plugin or … Read more
You should be using wp_enqueue_script rather than putting script tags directly in template files: function wpa61143_enqueue_scripts() { if( is_page( ‘home’ ) ) : wp_enqueue_script( ‘jcarousel’, get_template_directory_uri() . ‘/scripts/jquery.jcarousel.min.js’, array( ‘jquery’ ), null, true, ); elseif( is_single() ) : // enqueue scripts for single elseif( ! is_page_template(‘modelPages.php’) ) : // enqueue scripts for other endif; } … Read more