Custom Post Types and Posts are mixed
Custom Post Types and Posts are mixed
Custom Post Types and Posts are mixed
@Milo was absolutely correct…the issue was that I wasn’t getting a string to compare. The solution actually came from here. What this ultimately looked like in my scenario: <?php if(has_term(‘dining-1’, ‘page_category’, $post->ID)){ get_template_part(‘sidebar’, ‘dining-one’); } elseif(has_term(‘dining-2’, ‘page_category’, $post->ID)){ //etc. } ?>
Ok I figured it out. My custom post type was called press_release not press-release, and instead of returning no results, wordpress was returning some arbitrary collection of results that were broken in weird ways.
You can disable pagination per find() query in Pods by setting ‘pagination’ => false, I also suggest disabling search with ‘search’ => false. You can do this globally by setting these constants, which means you’ll have to explicitly enable search or pagination on the queries you want them enabled on by setting ‘pagination’ => true … Read more
Solved! I’ve created this script: <?php global $wpdb; $postwp = $wpdb->get_results ( “SELECT ID,post_author,post_title FROM wp_posts WHERE post_status=”publish” and post_type=”post”” ); $users = $wpdb->get_results ( “SELECT post_id,meta_value FROM wp_postmeta where meta_key = ‘id_utente_user'” ); foreach($postwp as $key1=>$value1) { foreach($users as $key2=>$value2) { if($value1->post_author==$value2->meta_value) { add_post_meta( $value1->ID, ‘autore’, $value2->post_id ); } } } ?> I hope … Read more
Your list of products is a list of taxonomy terms. You can get this list with those functions: get_terms($args) — Retrieve the terms in a given taxonomy or list of taxonomies. get_the_terms($post, $taxonomy) — Retrieve the terms of the taxonomy that are attached to the post. Clicking on a Product — is opening a custom … Read more
You can start yout work with upload_dir filtering. However, I wouldn’t recommend it (change this functionality). You will need to track few types of uploads and then track whoever is the parent of the upload. It’s more complicated, then joyful task.
The short answer here is you can’t check whether the upload is coming from a Pods Advanced Content Type, especially since the media that gets uploaded has no post_id associated to it (it’s not a post at that point). The longer answer is that you can still customize this if your file upload field is … Read more
Shouldn’t is_singular() work: Returns true if the post_type is “foo”. if ( is_singular( ‘foo’ ) ) { //code } Another option would be get_post_type(): Retrieves the post type of the current post or of a given post. if ( ‘foo’ == get_post_type() ) { //code } In the end it is all a matter of … Read more
Content -> Post is easy, but Post -> Content is hard