Menu
  • HOME
  • TAGS

Delete metadata in WP admin custom columns

wordpress,custom-post-type

Done! Change Admin Columns: add_action( "manage_favor_posts_columns", "change_columns" ); function change_columns( $cols ) { $cols = array( 'cb' => '<input type="checkbox" />', 'title' => __( 'Título del favor', 'trans' ), 'usuarios_registrados' => __('Usuarios Registrados', 'trans'), 'date' => __( 'Fecha publicación', 'trans' ), ); return $cols; } add_action( "manage_posts_custom_column", "custom_columns_phi", 10, 2...

Wordpress custom post_type archive url and default query

php,wordpress,templates,themes,custom-post-type

The rewrite parameter in the arguments you pass to register_post_type determines the permalink for your custom post type archive. https://codex.wordpress.org/Function_Reference/register_post_type Looking at the example in the documentation: $args = array( 'labels' => $labels, 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'show_in_menu' => true, 'query_var' => true, 'rewrite' =>...

How to display custom post type in a submenu?

menu,wordpress-plugin-dev,custom-post-type

Probably i think you want to add a custom type post as sub-menu in WordPress dashboard. You can do. add_action( 'admin_menu', 'my_plugin_menu' ); function my_plugin_menu(){ add_menu_page('Page title', 'Top-level menu title', 'manage_options', 'my-top-level-handle', 'my_menu_function'); add_submenu_page( 'my-top-level-handle', 'Custom Post Type Admin', 'Articles', 'manage_options','edit.php?post_type=page_article'); } Don't forget to add below code while registering...

Loading sidebar blocks based on post type

php,wordpress,magento,custom-post-type,fishpig

Thanks to @BenTideswell for alerting us to the fact that this extension already provides an appropriate layout handle that can be used for this purpose, so we don’t need to create another one. We only need to do a couple of layout XML updates that target the appropriate post type:...

Wordpress custom post type dropdown list on another post type in editor [closed]

php,html,wordpress,custom-post-type

As everything in PHP, to create a list of objects, you have to follow these steps. Firstly, get the data. <?php $data_terms = get_terms('your_custom_taxonomy', array( 'orderby' => 'count', 'hide_empty' => 0, 'parent'=>13 // You need the Id of the parent actors taxonomy ) ); ?> Now you can display it...

Pagination Custom Post Type with Custom Category/Taxonomy

php,pagination,custom-post-type,taxonomy

I found a solution to this problem. Here's the final script I'm using – in case anyone else has been looking for this answer as well: <?php // get_posts in same custom taxonomy $posttype = get_query_var(post_type); $taxonomies=get_taxonomies( array( object_type => array ($posttype) ), 'names' ); foreach ($taxonomies as $taxonomy )...

Custom Loop Pagination in Wordpress

wordpress,pagination,custom-post-type

I am assuming you've definded $location_query like this $location_query = new WP_Query($args);, now in your args add posts_per_page => 10. This will split your results in 10 items per page. If your pagination doesn't show new items on the next page make your query like this: $paged = (get_query_var('paged')) ?...

Wordpress custom post types for different styled paragraphs

php,wordpress,wordpress-theming,custom-post-type,custom-wordpress-pages

I did exactly this a while ago. If you do not mind paying a little bit for a great plugin. Step 1: Get the advanced Custom Fields Plugin - Awesome for Custom fields and really simple to add to you template. Step 2: Buy the repeater field plugin for Advanced...

I am having trouble excluding a custom taxonomy from an archive page for a custom post type in wordpress

php,wordpress,custom-post-type,exclude

You have to include the tax_query parameter in query array like here: $query_args = array( 'showposts' => 30, 'paged' => $paged, 'post_type' => 'my_custom_post_type', 'tax_query' => array( array( 'taxonomy' => 'custom-taxonomy-name', 'field' => 'slug', 'terms' => 'slug-name', 'operator' => 'NOT IN') ), ) ); $wp_query->query($query_args); Please write your custom taxonomy...

Check out my age range is matching or not with the 'date of birth' stored in database

php,mysql,wordpress,custom-post-type,wpdb

You should let Wordpress build that meta query for you - you can use get_posts to achieve this. Here is a suggestion : $meta_query = array(); if($sltNationality != '' && $sltNationality != 'Any') { // nationality query array_push($meta_query, array( 'key' => 'nationality', 'value' => $sltNationality )); } if($age != ''...

js popup loads content from first post only instead of individual posts

javascript,wordpress,custom-post-type

It's happening because you are creating a popup for each member, but they all have the same id. That is incorrect syntax and as such JavaScript will not behave as you expect it to. (If you want the ID to recur for all for styling or other scripts, use a...

Wordpress - custom post types with custom fields, gone from admin menu

php,mysql,wordpress,custom-post-type

AS the data is intact in the front end it means the entries are still in database and nothing is lost. It is correct way to just re-add the missing post-type and WordPress will now automatically re-link/re-connect your existing data, since WordPress is storing custom post type in the wp_posts...

Wordpress - changing a custom post type archive link

wordpress,rewrite,custom-post-type

Try using the add_rewrite_rule() function is your functions.php file. Try this: add_action( 'init', 'rewritePostType' ); function rewritePostType(){ add_rewrite_rule('^wpdirectory/([^/]*)/?','index.php?post_type=$matches[1]','top'); add_rewrite_tag('%post_type%','([^&]+)'); } Otherwise you can overwrite the permastructures in Settings -> Permalinks in Wordpress and hard code it in....

Wordpress custom posts : restrict “meta_key” to “post_type”

wordpress,custom-post-type,custom-taxonomy

At the moment your function will run for every save post action. You should query if it is the custom post type before continuing on. Another way and also a good idea is to add a nounce. Also you dont need add_post_meta instead use update_post_meta which will create a new...

Wordpress: How to display post count in author page by custom taxonomy

php,wordpress,custom-post-type,custom-taxonomy

Your only way to acvieve this will be to run two separate queries and counting the posts returned from the two separate queries. For this we will use get_posts as get_posts already passes a few important defaults to WP_Query to make the query faster and more performance orientated. We will...

wordpress wp_include_post() in custom post with coustom field

wordpress,custom-post-type,custom-fields

Advanced Custom Fields saves the post meta a little differently. WHat you have to do here is instead of including the post meta in the wp_insert_post after wp_insert_post( $my_post ); returns the ID of the post created. Use the Post ID with the acf function update_field() to update the post...

Wordpress: Link a post to posts of another category manually [closed]

php,wordpress,custom-post-type,posts

I recommend using the AdvancedCustomFields-Plugin. With this you can build a "relationship" between your post type 'events' and the 'speakers'. This way you can choose the 'speakers' on every 'event'. The Plugin is well documented. See for yourself how it works: http://www.advancedcustomfields.com/resources/relationship/...

Advance Custom Fields - All fields from one field group in one frontent array?

arrays,wordpress,frontend,custom-post-type,acf

Ok this is what i have at the end, and it's working. <?php $args = array( 'post_type' => 'company', 'posts_per_page' => 15 ); $loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post(); ?> <div class="boxy"> <div class="acf_company_name"> <h5>Company Name: </h5> <p><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_field('company_name'); ?></a></p>...

How to get Last post Id of custom post type in wordpress

wordpress,post,custom-post-type

I have got my last inserted Post id using $wpdb query as below- global $wpdb; $lastrowId=$wpdb->get_col( "SELECT ID FROM wp_posts where post_type='soto_property' ORDER BY post_date DESC " ); $lastPropertyId=$lastrowId[0]; ...

Change upload_dir folder at a certain cpt but cant change back

wordpress,upload,wordpress-plugin,wordpress-plugin-dev,custom-post-type

I found! this will only change the upload dir when upload in the "rsg_download" CPT add_filter( 'wp_handle_upload_prefilter', 'rsg_pre_upload' ); function rsg_pre_upload( $file ) { add_filter( 'upload_dir', 'rsg_custom_upload_dir' ); return $file; } function rsg_custom_upload_dir( $param ) { $id = $_REQUEST['post_id']; $parent = get_post( $id )->post_parent; if( "rsg_download" == get_post_type( $id )...

Archive for Custom post type categories [closed]

php,wordpress,custom-post-type

Yes you can add Archives there by setting has_archive into true. $args = array( 'labels' => $labels, 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'show_in_menu' => true, 'query_var' => true, 'rewrite' => array( 'slug' => 'book' ), 'capability_type' => 'post', 'has_archive' => true, 'hierarchical' => false, 'menu_position' =>...

Efficient way of getting meta values in WordPress

php,wordpress,content-management-system,custom-post-type

All WordPress post meta data is internally cached, running your own SQL query will not have this benefit (unless you implement your own caching). The function get_post_meta() calls get_metadata(), which in turn calls wp_cache_get(). And from that point on, where it goes inside the class WP_Object_Cache, I got lost... Anyway,...

How to show post formats in custom post types?

php,wordpress,wordpress-plugin,custom-post-type

'post-formats' need to add in 'support'..may be halpful 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments', 'post-formats') ...

Wordpress Custom Post Logic

wordpress,custom-post-type,custom-taxonomy

I'll answer your second question first: Yes, the template you should use for displaying all the custom post types would be the CPT archive, so "archive-video.php" sounds right. For the categories (the exact way to say it would be "taxonomy terms" indeed), you would use "taxonomy-{taxonomy}.php" or even "taxonomy-{taxonomy}-{term}.php" if...

Wordpress custom meta box not saving all data

php,wordpress,custom-post-type,meta

The "name" of your of your 'oak_credits' metabox are wrong : // Add Credits Metabox function oak_credits() { global $post; // Noncename needed to verify where the data originated echo '<input type="hidden" name="creditsmeta_noncename" id="creditsmeta_noncename" value="' . wp_create_nonce( plugin_basename(__FILE__) ) . '" />'; // Get the credits data if its already...

Custom post type pagination not working

wordpress,pagination,custom-post-type

Edit: problem fixed with the below code - <?php if (get_query_var('paged')) { $paged = get_query_var('paged'); } elseif (get_query_var('page')) { $paged = get_query_var('page'); // Display posts from current page on a static front page } else { $paged = 1; } $args = array( 'paged' => $paged, 'posts_per_page' => 1, 'post_type'...

WordPress, taxonomy page not linking up

php,html,wordpress,post,custom-post-type

Sometimes if you make taxonomies on the fly, wordpress does't update it. Just goto your settings > Permalinks and click update

Single page template not working for custom post type

wordpress,url-rewriting,wordpress-theming,hierarchy,custom-post-type

Solved following way: Disabled the framework and enabled it again. It works :)

Display post from custom post type

php,wordpress,custom-post-type,wordpress-loop

It looks like you need to add post_type => "opinion"to your query args. $normal_args = array( 'ignore_sticky_posts' => 1, 'order' => 'desc', 'meta_query' => array( array( 'key' => '_custom_blog_enhome', 'value' => '1', 'compare' => '=' ) ), 'post_type' => 'opinion' 'post_status' => 'publish', 'posts_per_page' => 6 ); ...

Two questions about post_type function in wordpress

php,html,wordpress,wordpress-theming,custom-post-type

Come on. 1) Permalinks use <?php the_permalink();?> 2) To your page, try this <?php /* Template Name: Our Works */ ?> <?php get_header(); ?> <!-- begin colLeft --> <div id="colLeft"> <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts(array('paged' => get_query_var('paged'), 'posts_per_page'=>5, 'post_type'=>'our_works', 'order' => 'ASC'))?> <h1><?php the_title(); ?></h1> <div>...

WP - Shortcode to query custom post type and display according to custom meta value

php,wordpress,custom-post-type

You can use the meta_query or key/value pairs. Read here. $query = new WP_Query(array( 'post_type' => 'programmes', 'meta_query' => array( array( 'key' => 'broadcast-date', 'value' => '2014-12-11', //The date what you want... 'compare' => '>=' ), ), )); ...

Get ALL post types in WordPress in query_posts

wordpress,custom-post-type

You can use 'post_type' => 'any' for fetching from all post types. See this documentation. http://codex.wordpress.org/Class_Reference/WP_Query#Type_Parameters Note: It is highly recommended to use WP_Query rather than query_posts. http://wordpress.stackexchange.com/a/1755/27998...

Custom post type to work with html auto reply

wordpress,custom-post-type,auto-responder

on the file single-landing_page.php create a hidden form field <input type="hidden" name="custom_postmeta" value="<?php echo esc_html( get_post_meta( get_the_ID(), 'landing_pages_short_description', true ) ); ?>" /> then on the other file as you get all other fields you can get this hidden field too like $custompostmeta = $_POST['custom_postmeta']; then concatinate this $custompostmeta variable...

wordpress with WP_QUERY and javascript “Onclick” doesn't works

wordpress,onclick,custom-post-type

First of all, make sure you move the JS function outside of the loop, else it would just output for each found post. Interestingly, you call the toggle function with the ID of the element as a parameter, but the function is not defined with parameters. Thus, the toggle function...

Custom Post type slider

wordpress,responsive-design,slider,custom-post-type

There is a great slider by woothemes called flexslider personally I use it on all my sites and you can use it without a plugin. Download the slider from that link i provided. copy the flexslider.css file and jquery.flexslider-min.js file into your theme folder. in your header.php <link rel="stylesheet" href="<YOUR_THEME_LINK>/flexslider.css"...

Wordpress custom post type structure

wordpress,custom-post-type

You're correct that you'll need to use a custom post type. To add the fields you have two options: Add the fields using add_meta_box(). You'll then need to save this data as post meta. Then in your single-person.php template you would retrieve the meta using get_post_meta(). It's a tad cumbersome,...

Why the sliding effect isn't working inside a loop?

jquery,wordpress,custom-post-type,sliding,captions

cut&paste this block <script> jQuery(document).ready(function() { jQuery('.imgBlock').hover( function() { jQuery(this).find('.bildText').slideDown(300); }, function () { jQuery(this).find('.bildText').slideUp(300); } ); }); </script> to the very start of your file. you have it inside your loop, so it gets outputted multiple times. you only need this block once. i can imagine that this kills...

wordpress custom post type do not show up in menu page

php,wordpress,custom-post-type

Solution: In the backend, you have to current admin page's options at the top of the screen. The CPTs are not shown there by default, but can be activated there. Source: http://wordpress.stackexchange.com/a/37801/9241...

Custom post type meta not showing `add_meta_box`

php,wordpress,custom-post-type

Update Your add_meta_box function is not passing the correct arguments. Argument #4, $screen is the post types you want to show the meta boxes for. Use the following; function slider_create_slider(){ register_post_type('imageslider' ... } function slider_add_meta_boxes($post) { add_meta_box('ImageSliderMeta',__('image'),'slider_image_meta_box', 'imageslider'); } http://codex.wordpress.org/Function_Reference/add_meta_box...

Using custom categories and custom posts types (Bones Theme)

php,wordpress,custom-post-type

Worked it out function sherwood_get_posts( $category_name ) { // set the criteria $args = array( 'numberposts' => -1, 'post_type' => 'custom_type', 'tax_query' => array( array( 'taxonomy' => 'custom_cat', 'field' => 'slug', 'terms' => array($category_name)) ) ); // return the object array of the posts. return get_posts( $args ); } ?>...

wordpress - is it possible to add one post with multiple custom post type

php,wordpress,wordpress-plugin,category,custom-post-type

This is fact that a single can not be two types because in the Database we can store only a single value for this. But according to your case I don't think this is a difficult task. You have only the problem of back end that you are unable to...

Wordpress custom post action hook

php,wordpress,wordpress-plugin,wordpress-plugin-dev,custom-post-type

Not sure if there is just one action but here are the various actions: save_post (create or update) wp_delete_post (deleted) wp_trash_post (trashed) so you can do something like this: function my_callback_function() { if($post->post_type = 'job') { //do something here } } all_actions = array('save_post','wp_delete_post','wp_trash_post'); foreach ($all_actions as $current_action) { add_action($current_action,...

How to make a page template for displaying custom type posts

wordpress,custom-post-type

firstly create a custom page template by doing the following: Copy the regular page.php and rename it to page-movies.php. In the page header add the following php code: /** * Template Name: Movie Page */ Now the page template should be available in the backend, select the Movie Page as...

Wordpress custom permalinks

wordpress,.htaccess,rewrite,custom-post-type,permalinks

I manage to solve my issue and create the permalinks the way I wanted. I created my post types like I wanted but I had to put a lot of if/else statement in my header to properly manage my pages and post type to ensure that the right page was...

How to hide Permalink section from a Custom Post Type's post?

wordpress,custom-post-type,permalinks,posts

Under register_post_types add the following arguments. 'public' => false, // it's not public, it shouldn't have it's own permalink, and so on 'publicly_queriable' => true, // you should be able to query it 'show_ui' => true, // you should be able to edit it in wp-admin 'exclude_from_search' => true, //...

Wordpress Custom Post Type Search

wordpress,wordpress-plugin,wordpress-theming,custom-post-type,wordpress-theme-customize

We've had a lot of success using Relevanssi plugin for altering WordPress's search functionality. You can have WordPress index custom fields, excerpts, and other things, and also add more or less weight to them in your search results. In the excerpt's settings, check the box shown in the screenshot below:...

Get 2nd latest custom post type

wordpress,custom-post-type,wp-query

You can use an offset to skip over the first post. Example: $second_latest = new WP_Query( array( 'post_type' => 'car', 'post_status' => 'publish', 'posts_per_page' => 1, 'orderby' => 'modified', 'order' => 'DESC', // in OP you're using ASC which will get earliest not latest. 'offset' => 1, // skip over...

Adding two value to WP custom fields

html,css,wordpress,custom-post-type

You can simple append your class after post-1 with comma separator. It would be look like post-1,bgAlign,one-more-class. Use this to output <?php global $post; ?> <div class="<?php echo str_replace(',', ' ', get_post_meta($post->ID, 'ExtraCSS', true)); ?>"></div> Changing commas with spaces...

Get categories for a single post in a custom post type

php,wordpress,custom-post-type,categories,slug

Got it! Found this article that helped me out: https://wordpress.org/support/topic/how-to-get-the-category-name-for-a-custom-post-type <?php $projects_loop = new WP_Query( array( 'post_type' => 'projects', 'posts_per_page' => '900', 'orderby' => 'menu_order' ) ); ?> <?php while ( $projects_loop->have_posts() ) : $projects_loop->the_post(); ?> <?php $terms = get_the_terms($post->ID, 'project-type' ); if ($terms && ! is_wp_error($terms)) : $term_slugs_arr =...

Wordpress: Custom post type segregation on Category page

wordpress,category,custom-post-type

What you are trying to do is possible with one query only, and only with the main query without any custom queries. First of all, lets first add your custom post types to your category page. By default, custom pist types are excluded from category pages. So we need to...

WordPress Taxonomy get category

php,html,wordpress,custom-post-type

This is a bit difficult because you attached two different taxonomies to your post type 'products'. Since your taxonomy is hierarchical it would have been easier to have put everything in one taxonomy with 'Internal Prodcuts' and 'External Products' on the top level. In you case you will have to...

get post by category id in custom post type with custom taxonomy

wordpress,custom-post-type,custom-taxonomy

You need to add 'tax_query', not 'cat'.. $ourteam_category_check = '191'; $niche_ourteam_args = array( 'post_type' => 'ourteam', // 'cat' => $ourteam_category_check, 'orderby' => 'post_date', 'order' => 'DESC', 'post_status' => 'publish', 'meta_query' => array( array( 'key' => '_thumbnail_id', 'compare' => 'EXISTS' ), ), 'tax_query' => array( array( 'taxonomy' => 'member-category', 'field' =>...

Wordpress Pods plugin - Template Content field doesn't show up

wordpress,custom-post-type,podscms,genesis

This issue, which is a caused by xcache on certain servers, is fixed in Pods 2.5-beta. You can get it from our GitHub or from http://pods.io/latest

Hook Custom post after every 5 posts

wordpress,loops,custom-post-type

May be there in no hook for that or i don't know about that, But You can do something like this:- <?php $postnum = 0; // Set counter to 0 outside the loop if (have_posts()) : while (have_posts()) : the_post(); // Do regular stuff $postnum++; // Increment counter if ($postnum...

Show advanced custom field value in custom column (wp_list_table)

wordpress,function,custom-post-type,advanced-custom-fields

I found the answer to my question it looks like my filter, action and functions where not named properly. I did not add the custom post type(address) correctly(stupid) and everywhere needed. After doing so, everything started working fine. Thanks for the help. add_action("manage_address_posts_custom_column", "address_custom_columns"); add_filter("manage_edit-address_columns", "address_edit_columns"); function address_edit_columns($columns){ $columns =...

Wordpress Custom Post Type categroies

wordpress,custom-post-type,advanced-custom-fields

You can do that with Post Types UI, You will need to create a new taxonomy. Here is the screenshot explaining that https://s.w.org/plugins/custom-post-type-ui/screenshot-4.png?r=1180724 Just fill the text boxes with appropriate names, and check STORY under "Attach to Post Type" option. After that you will have custom taxonomy like "Story Category"...

WP - Categories in custom post type

php,wordpress,custom-post-type,categories

When you're registering your post type, you're registering it to the categories post_tag and category. function blog_post_type() { // some labels $args = array( // more args 'taxonomies' => array('post_tag', 'category'), ); register_post_type( 'blog', $args ); } But later on, you are registering a taxonomy called blog_category (see first parameter...

WP_Query won't return one of the custom post types when multiple post types requested

wordpress,custom-post-type

OK, I got it. Absolutely ridiculous as expected. One of the custom post types was not translated and checked in Polylang Settings because it was added after the plugin was configured. Settings->Languages->Settings->Custom post types Damn....

Make Custom Post Archive in Ascending Order

php,wordpress,custom-post-type

Use a simple query here. Don't use query_posts, never ever. Use WP_Query. You should do <?php $args= array( 'order' => 'ASC', 'post_type' => 'NAME OF YOUR CPT' ); $the_query = new WP_Query( $args ); ?> <?php while ( $the_query->have_posts() ) :$the_querythe_post(); ?> ...

Wordpress get post order by custom category

wordpress,category,custom-post-type

$args = array( 'post_type' => $post_type, 'post_status' => 'publish', 'caller_get_posts' => 1, 'tax_query' => array( array( 'taxonomy' => 'weeks', ), ), 'orderby' => 'post_title', 'order' => 'ASC', ); ...

Wordpress Custom Post type archive display

wordpress,templates,custom-post-type,advanced-custom-fields

you are guessing right, first you need a page template where you are going to call your terms, but you need to call by his taxonomy, right?, To do that, you need to use the function get_terms( $taxonomies, $args );, and with the function get_term_link($term), you are going to obtain...

get_option intermittently fail WordPress

php,mysql,wordpress,custom-post-type

Through the help of my network I found the solution to the problem. The line where I am calling: <?php $category_meta = get_option( "category_$term_taxonomy_id"); ?> I switched to this: <?php $category_meta = get_option( "category_$term_id"); ?> This seems to have resolved the problem. However, here are some other solutions that might...

Query custom post type with jQuery.load()

javascript,jquery,wordpress,custom-post-type,wp-query

Yes in .load() function do not use server url but relative path such as ./path of js folder/js file.js. hope it will work for you Just check the link here for jquery docs...

WP navigation post of a custom post type

php,wordpress,custom-post-type

Try this <?php $term_list = wp_get_post_terms($post->ID, 'TAXONOMY', array("fields" => "slugs")); if (empty($term_list[1])) { print_r($term_list[0]); $termo = $term_list[0]; } else { print_r($term_list[1]); $termo = $term_list[1]; } // get_posts in same custom taxonomy $postlist_args = array( 'posts_per_page' => -1, 'orderby' => 'menu_order title', 'order' => 'ASC', 'post_type' => 'CUSTOM-POST-TYPE', 'taxonomy'=>'TAXONOMY', 'term'=>$termo, );...

cannot enter text into the text fields on a form when using IE

custom-post-type,custom-taxonomy

The text is there, just hidden. I proved this by writing something in there then shift + left arrow to highlight whatever (if anything was in there) and copying it out. It worked. In terms of the issue it seems to be linked to the padding size. 16px with a...

Wordpress list category in custom post type

php,wordpress,custom-post-type,categories

You can use wp_get_post_terms: <?php $taxonomy = 'resource-category'; $tax_terms = wp_get_post_terms($post->ID, $taxonomy, array("fields" => "all")); foreach ($tax_terms as $tax_term) { echo '' . '<a href="' . esc_attr(get_term_link($tax_term->term_id, $taxonomy)) . '" title="' . sprintf( __( "View all posts in %s" ), $tax_term->name ) . '" ' . '>' . $tax_term->name.'</a>&nbsp;&nbsp;&nbsp; ';...

Wordpress - showing last uploaded images, but only from a specific custom post type

wordpress,attachment,custom-post-type

I don't believe it's possible to use WP_Query to filter based on the post type of the parent. The most straightforward way around this is to use SQL and $wpdb->get_results() directly. This will also bypass all built in caching, etc so think about how your implementation will be used. global...

Wordpress displays 10 post type items

php,wordpress,wordpress-theming,custom-post-type

Have a look at the 'Settings -> Read' page in the Wordpress admin pages. There you can configure how many posts should be displayed per list page. This blog post can also be useful: http://weblogs.about.com/od/wordpresstutorialstips/tp/How-To-Configure-Wordpress-Reading-Settings-For-Your-Blog.htm Best of luck! /Wille...

Custom post type date output

wordpress,date,custom-post-type

Do this echo date('d m, Y', strtotime(get_post_meta($post->ID, "_closingdate"))); ...

Trying to show a user's custom post type posts in their buddypress profile?

wordpress,wordpress-plugin,custom-post-type,buddypress,author

You're trying to use $bp without including it as a global. But you don't need it. Try changing 'author' => $bp->displayed_user->id, to 'author' => bp_displayed_user_id(), ...

Custom post type - Template page not being found

wordpress,templates,custom-post-type

I think there could be a name conflict. Well, I had one once. If there's an archive for your post type it's name is automatically "showroom", so maybe it chooses the showroom archive over the showroom page. Did you try to rename your page to check if there's a conflict?...

Can't getting same postname slug for multiple custom Post Type

wordpress,custom-post-type,permalinks

After searching for hours... I finally figured it out. Posting this for everyone who might encounter the same issue. I have got 2 solutions: Install a plugin called Allow Duplicate Slugs By John Blackbourn Another one is Add a function to function.php ...

Date archives for custom post type

php,wordpress,custom-post-type

There are many examples on the Internet similar as your, but the problem is that although wp_get_archive() will create a list of custom post type archives, the links still points to the default post type. This is because Wordpress do not generate rewrite rules for the archives of the custom...

wp_query with multiple custom fields returning 0 results

php,mysql,wordpress,custom-post-type

array ( 'key' => 'ys_product_start', 'value' => date('Ymd'), 'compare' => '>=' ), array ( 'key' => 'ys_product_end', 'value' => date('Ymd'), 'compare' => '<=' ) here: ys_product_start >= date('Ymd') AND ys_product_end <= date('Ymd') its mean a row must met the both conditions but no one can Row 1 NOT 20141101 >=...

Wordpress Custom post query for slider

php,wordpress,slider,custom-post-type

<?php if(!is_paged()) { ?> <?php $args = array( 'post_type' => 'slider', 'posts_per_page' => 5 ); $loop = new WP_Query( $args ); $count=1; ?> <div class="slider"> <div class="slide_item"> <?php while ( $loop->have_posts() ) : $loop->the_post(); ?> <div class="child_item_of_every_slide">Child Slide Items with different Content</div> <?php if($count%4==1&&$count>1){ echo '</div><div class="slide_item">'; } $count++; ?>...

Gathering Custom post types via tags

php,wordpress,custom-post-type

Wordpress Query Parameters If you add :: $args = array( 'post_type' => array( 'sectors' ) //, 'multiple_types_after_commas' ) ); $query = new WP_Query( $args ); or $query = new WP_Query( 'post_type=sectors' ); This will help you target your post type with your query. It will look like $args = array(...

Target the next ID inside the Loop (WP)

wordpress,custom-post-type

I'm not keeping any selections within your displaying of posts in mind, but I figure you can get 'round by using get_next_post(). Something like: global $post; $post = get_post($post_id); $next = get_next_post(); $next_id = $next->id; ...

Use Custom Post Archive Page for a specific Custom Post

php,wordpress,templates,custom-post-type

You're referring to specialized page templates. Your best bet is to create a new template for this page specifically. From the Codex: Create a template for one Page: For more extensive changes, intended for just one specific Page, you can create a specialized template file, named with that Page's slug...

Wordpress: Plain links in single-class.php and archive-class.php not working

php,wordpress,hyperlink,custom-post-type

Javascript is preventing those links from firing. It appears to be coming from this section in scripts.js starting on line 8: $('.class').click(function(e) { e.preventDefault(); }); All links that are children/grandchildren of element with class 'class' will become void, which is causing all of your links to fail....

How to break non text editor content into multiple pages (wordpress)

php,html,wordpress,custom-post-type

There are some ways to do this, however none of them are native to WP functions. 1. You can add a Shortcode. The idea is that you register a shortcode, with what you want to show like [post-image-stuff] and then you add that code to your post content and it...

Add categories to custom post type and display based on categories

wordpress,category,custom-post-type

Both of the other answers are incorrect, specially the one from the OP. query_posts should NEVER EVER be used, it is even stated in the codex, so please, read the codex. Also, you should never replace the main query with custom queries. The solution is simple as I have described...

Wordpress category filter doesn't filter on sub categories

php,wordpress,category,custom-post-type,wp-query

You have to do several different WP_Query's with the restraining arguments to get only those posts you want. You will have to do several loops if you want it to limit them to one sub category. You might have to make templates for these category pages and put your customized...

wordpress : how to add commas between meta terms on single custom post type

php,wordpress,custom-post-type,meta

You're code is ok, you just need to modify the output a bit. Try this code: //get all taxonomies and terms for this post (uses post's post_type) foreach ((array) get_object_taxonomies($post->post_type) as $taxonomy) { $object_terms = wp_get_object_terms($post->ID, $taxonomy, array('fields' => 'all')); if ($object_terms) { echo ': (- ' . $taxonomy ....

Update Advanced Custom Field from HTML form

php,wordpress,insert,custom-post-type,advanced-custom-fields

I think you simply need to use the ACF function update_field($field_key, $value, $post_id) In your case it would be something like: update_field( 'field_4fc5ab37e1819lol', htmlentities($_POST['text_ACF']), $post_id ); In order to find the field key, go to the Field Group edit screen, and click Screen Options on the top-right corner, as you...

Sphinx Wordpress plugin narrow results by custom meta_key

php,sql,wordpress,sphinx,custom-post-type

After lots of testing I've accomplished what I was looking for by modifying the SQL query of source {prefix}main_posts{} inside the sphinx.conf file as the following: sql_query = select \ p.ID*2+1 as ID, \ 0 as comment_ID,\ p.ID as post_ID,\ p.post_title as title, \ p.post_content as body, \ t.name as...

Wordpress Custom Post Type Post not showing

php,wordpress,custom-post-type

Something similar happened to me a while ago, it gone well after I used this functon. flush_rewrite_rules(); Try after the closure of the register_taxonomy Like this register_post_type( 'booking', array( 'labels' => $labels, 'supports' => array( 'title', 'author' ), 'public' => true, 'exclude_from_search' => true, 'show_in_nav_menus' => false, 'capability_type' => 'for_subscriber',...

Feature thumbnails for specific custom post types

wordpress,thumbnails,custom-post-type

You need to define the support for feature images, so add the following line after each array for all the custom post types. 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'sticky') You can of course remove or add the features you need or don't. See all supports in the codex:...

Adding a menu to a custom post type sub page in wordpress

wordpress,custom-post-type

To check if a singular post is being displayed, use is_singular(): if( is_singular( 'video' ) ) { // do stuff } ...

Wordpress function to effect only one (custom) post type, and not every post

wordpress,custom-post-type

You're looking for get_post_type(): function custom_default_cover_image( $image = null, $args = null ) { global $post; if ( get_post_type() === 'job_listing' && ! $image ) { $image = array( 'http://website.com/image.jpg' ); } return $image; } add_filter( 'cover_image', 'custom_default_cover_image', 10, 2 ); ...

WordPress 3.9 - need a function to get Custom Post Type name to auto-fill Category in Dashboard

wordpress,category,custom-post-type,dashboard

Here is the answer, in case anyone else needs to do this: function set_my_categories($post_id){ $post_type = get_post_type($post_id); switch( $post_type ){ case 'News': wp_set_post_categories( $post_id, array(5)); break; case 'Events': wp_set_post_categories( $post_id, array(12)); break; case 'Reports': wp_set_post_categories( $post_id, array(8)); break; case 'Videos': wp_set_post_categories( $post_id, array(9)); break; } } add_action('save_post', 'set_my_categories');...

How to create custom blog page for custom post types?

wordpress,custom-post-type,wordpress-loop

well, I assume that your permalink settings are set to the post name. first refresh your permalink settings. custom post types has it's own archive page. www.yoursite.com/{your_post_type_slug} you dont have to create any page for that. That will work automatically after you registered the custom post type. so write your...

Comma seperation only working on first 2 foreach items?

php,wordpress,custom-post-type

Because of your statement. You checks firstly for !$commaCheck, what is defaultly true, because $commaCheck is 0, but then you ascend it. So it will be false. Remove the ! before $commaCheck or put it in a () so like this: !($commaCheck >= $count) (I dont know which logic do...

Wordpress same archive template for custom post type and taxonomy

php,wordpress,custom-post-type,taxonomy

You can make use of the template_include filter to set the template you need for a specific condition You can try something like this add_filter( 'template_include', function ( $template ) { if ( is_tax( 'topics' ) ) { $new_template = locate_template( array( 'archive-video.php ' ) ); if ( '' != $new_template...

WordPress Custom Post Type Meta Box tinyMCE

php,wordpress,custom-post-type,meta-boxes

for function "display_missionary_meta_box", argument name should be $post instead of $missionaries in order to user $post->ID in the function // Put Fields In Missionary Meta Box function display_missionary_meta_box( $post ) { $missionary_contact_details = get_post_meta($post->ID, 'missionary_contact_details', true); ?> <table> <tr> <td><?php wp_editor($missionary_contact_details, 'missionary_contact_details', array( 'wpautop' => true, 'media_buttons' => false, 'textarea_name'...