Is there a way to relate custom post types?
The simplest way is probably this plugin: Posts 2 Posts http://wordpress.org/extend/plugins/posts-to-posts/
The simplest way is probably this plugin: Posts 2 Posts http://wordpress.org/extend/plugins/posts-to-posts/
You have to set ‘slug’ to false and not a blank string.
You need to be storing your dates in some sortable format such as YYYY-MM-DD, or as a unix timestamp, otherwise you can’t do this just with a query. Once it’s in the format YYYY-MM-DD this should work. try this: function concerts_pre_get_posts( $query ) { if ( !is_admin() ) return; if ( isset( $query->query_vars[ ‘post_type’ ] … Read more
Second try: 😉 pre_get_posts runs AFTER parse_query(). parse_query() transforms ‘meta_key’ etc. into ‘meta_query’. get_posts() doesn’t seem to react on ‘meta_key’ etc. directly. So try adding $query->parse_query() after your $query->set() calls or use filter that runs before parse_query (edited, the parse_query() filter doesn’t work, either – it runs too late). Edit: to do the switch: function … Read more
1) Yes, there’s better ways…one would be to use a shortcode instead of storing php in your db. Write and register a shortcode callback that reads your file and returns the content and replace your <?php … ?> section in the post with the shortcode. Also, you can read the file with file_get_contents();, saves you … Read more
$todaysDate needs to be an array of two values to be BETWEEN for the compare. For example if you wanted to use a date range from today to a week in the future, then you might use something like.. $todaysDate = array( date(‘Y/m/d’), date(‘Y/m/d’, strtotime(‘+1 week’) ) ); Or if you wanted to go back … Read more
First: (Really!) get someone who understands a lot about code & wordpress. As you’ve already read Mike Schinkels site: He’s a good one. can I scale the website without worrying too much into maintaining the technical aspects of the site? If you, as i stated above, got some who makes you a solid foundation, then … Read more
You can use pre_get_posts hook to add your custom post type to the query function include_recipes( $query ) { if ( $query->is_category ) { $query->set( ‘post_type’, array(‘post’,’recipes’) ); } return $query; } add_filter( ‘pre_get_posts’, ‘include_recipes’ );
You can use get_queried_object to get the term name. <?php if( is_tax() ) { global $wp_query; $term = $wp_query->get_queried_object(); $title= $term->name; } ?> To display: <?php echo $title; ?> If your on a taxonomy archive page you can use: <?php $term = get_term_by( ‘slug’, get_query_var( ‘term’ ), get_query_var( ‘taxonomy’ ) ); ?> Then to display … Read more
The code indeed only looks at the TinyMCE editor or the title and content field if the editor is hidden: window.onbeforeunload = function(){ var mce = typeof(tinyMCE) != ‘undefined’ ? tinyMCE.activeEditor : false, title, content; if ( mce && !mce.isHidden() ) { if ( mce.isDirty() ) return autosaveL10n.saveAlert; } else { title = $(‘#post #title’).val(), … Read more