FAQ Database Discussion Community


Use Custom Post Archive Page for a specific Custom Post

php,wordpress,templates,custom-post-type
I'm stuck on this issue with my Wordpress setup. My current setup is as follows: I have a custom post type "degrees" that are categorized by undergraduate, graduate, online, and abroad. The initial page is a specific taxonomy template I have set up for the user to specify which degrees...

Show advanced custom field value in custom column (wp_list_table)

wordpress,function,custom-post-type,advanced-custom-fields
I made a custom post type named address and added values to it with the plugin advanced custom fields. I would like to display those values in a custom column in the wp-list-table. So I managed to add a column to the custom post type(address) called views. With the code...

Wordpress Custom Post Type categroies

wordpress,custom-post-type,advanced-custom-fields
I have a custom post type called STORIES. When a user adds a new STORY, I need them to be able to assign a category (or multiple categories) to the post so I can sort them later by category. To do this, I only want specific categories I assign to...

Wordpress list category in custom post type

php,wordpress,custom-post-type,categories
I have a query below which I want to list ONLY those categories assigned to the current post I am viewing. At the moment, it lists ALL of the categories for my custom post type. Is it possible to list just those for the individual post? The post type is...

How to make a page template for displaying custom type posts

wordpress,custom-post-type
I just started WP, and made a table with many rows arrived at WP house. But don't know how to show. basic content well shown but custom fields. learnt that a page have to be created to deal them in order to retrieve custom typed posts. the following is from...

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

wordpress,post,custom-post-type
I want to get last post id of a custom post type in wordpress. For this I tried this code- args = array( 'post_type' =>'soto_property', 'posts_per_page' => 1, 'orderby'=>'post_date', 'order' => 'DESC', ); $image_posts = get_posts($args); foreach ( $image_posts as $post ) { echo $post->ID; } But It always returns...

Loading sidebar blocks based on post type

php,wordpress,magento,custom-post-type,fishpig
I'm using the Fishpig WordPress extension for Magento (with the CPT extension) and I can't seem to figure out how to load sidebar blocks based on the type of the current post. I want to load a particular block only if: I'm viewing a single post with the type recipe...

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

wordpress,wordpress-plugin,custom-post-type,buddypress,author
-I have successfully added a new tab to the Buddypress profile page and I also have my custom tab displaying my custom recipes template located in (buddypress/members/single/recipes.php) function my_setup_nav() { global $bp; bp_core_new_nav_item( array( 'name' => __( 'My Recipes', 'buddypress' ), 'parent_slug' => $bp->profile->slug, 'slug' => 'recipes', 'position' => 30,...

WordPress, taxonomy page not linking up

php,html,wordpress,post,custom-post-type
I have a custom post type named Sectors, which was made using the code below: add_action( 'init', 'wpsites_custom_post_type' ); function wpsites_custom_post_type() { register_post_type( 'sectors', array( 'labels' => array( 'name' => __( 'Sectors' ), 'singular_name' => __( 'sector' ), ), 'has_archive' => true, 'hierarchical' => true, 'menu_icon' => 'dashicons-heart', 'public' =>...

Get ALL post types in WordPress in query_posts

wordpress,custom-post-type
I'm using query_posts to get a list of most popular posts. I'm using several custom post types, and instead of including all of them in the query, I would like a query that just gets all of them, also if I create more. This is what I have: query_posts(array( 'meta_key'...

Comma seperation only working on first 2 foreach items?

php,wordpress,custom-post-type
I've created a function to display the taxonomies of a Custom Post Type in WordPress, however I'm sure the problem's to do with something in the PHP: function portfolio_tax($x) { $terms = get_terms($x); $count = count($terms); $commaCheck = 0; foreach($terms as $term) { echo $term->name; if(!$commaCheck >= $count){echo ', ';}...

Query custom post type with jQuery.load()

javascript,jquery,wordpress,custom-post-type,wp-query
Im working on a site see here and I created a custom post type named "projects". When the page initially loads, Everything works fine, all the post data is loaded. But when I use $.load() to load the same code from an external file nothing gets displayed. It only appears...

Two questions about post_type function in wordpress

php,html,wordpress,wordpress-theming,custom-post-type
I'm making a child theme from this theme (limo) and I am trying to do two things without success, so here's my questions: How can I get a permalink from a post_type? As you can see on this demo (the "Our Works" part), I would like to get the link...

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

custom-post-type,custom-taxonomy
When on the site and using IE, it is not possible to type in the text fields, the two textareas work ok. Please can someone go to this site and look at 'view source' and tell me why it is not possible to type in the text fields while using...

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

javascript,wordpress,custom-post-type
I have custom post type "members", which stores their details within custom-post-meta. I am currently working in it's custom-post-type-archive page named "archive-members.php" which lists all these members, with their details. Now, I needed to display a meta-data related to each member into a simple js popup-box, so I used the...

wordpress custom post type do not show up in menu page

php,wordpress,custom-post-type
I have registered a custom post type and would like to add entries of this CPT into my menu. I have multiple users with the Admin Role, but they only show up under one specific user - the others simply don't see the Custom Post Types. // functions.php function register_cpt_trainings()...

Custom post type meta not showing `add_meta_box`

php,wordpress,custom-post-type
Not sure what've I've done wrong, probably something really silly like I've missed an attribute or something. Right I'm trying to build a feature on a theme that displays on the homepage. That bit I can do just fine. What I want to do is make this a little easier...

Wordpress custom post_type archive url and default query

php,wordpress,templates,themes,custom-post-type
I'm now using wordpress 4.2, and developing themes on it for my own site. I defined many custom post types in my theme, and I'm now finding a way to make some archive pages for them. For example, I have a post_type called shop, and have a taxonomy named region...

Wordpress custom post action hook

php,wordpress,wordpress-plugin,wordpress-plugin-dev,custom-post-type
I'm working on a plugin for wordpress that I would like to fire every time a custom post of the type 'job' is posted, published, edited, trashed, untrashed, etc. (basically whenever there is an update to that post type). I'm having a bit of trouble finding the correct action hook...

Wordpress Custom Post type archive display

wordpress,templates,custom-post-type,advanced-custom-fields
I have a custom post type named STORIES. Within that post type, I have categories, so each STORY is also assigned a category like this... Story 1 (assigned category RED) Story 2 (assigned category BLUE) Story 3 (assigned category GREEN) etc. I need to display a page which lists the...

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

jquery,wordpress,custom-post-type,sliding,captions
I have this code here which is working perfectly. It's a simple image and title that on mousehover it shows a descritpion. <div class="imageCont"> <div class="imgBlock thumbnail"> <a href="<?php the_permalink(); ?>" class="link-to-post" title="<?php the_title_attribute(); ?>" ><img width="300" height="150" src="http://www.tentacle.cat/wp-content/uploads/2014/11/DSC06267_Snapseed-Custom.jpg" class=" vc_box_border_grey attachment-thumbnail" alt="cartell2"> </a> <div class="undertext"> <h3...

Custom post type to work with html auto reply

wordpress,custom-post-type,auto-responder
I'm trying to setup a custom post type for Landing Pages in WordPress, including the option to customize the text for the html auto response email. I am able to call the post meta on a different page using using the following loop, but I can't figure out how to...

Gathering Custom post types via tags

php,wordpress,custom-post-type
I have set up my custom post type called 'sectors', using the code below: register_post_type( 'sectors', array( 'labels' => array( 'name' => __( 'Sectors' ), 'singular_name' => __( 'sectors' ), ), 'has_archive' => true, 'hierarchical' => true, 'menu_icon' => 'dashicons-heart', 'public' => true, 'rewrite' => array( 'slug' => 'your-cpt', 'with_front'...

Wordpress Custom Post Type Search

wordpress,wordpress-plugin,wordpress-theming,custom-post-type,wordpress-theme-customize
I have a WP installation with a menu/restaurant theme that adds a custom post type for "food". "food" has a title and an excerpt field it doesn't have the regular "content" field. It seems that the default WP search facility will search in the title and the content fields but...

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

wordpress,custom-post-type
I'm having an issue with a custom post type (WP Job Manager). I am using the following code in my functions file to 'add a default image to posts that have no image attached'. function custom_default_cover_image( $image, $args ) { global $post; if ( $image ) { return $image; }...

Wordpress: Custom post type segregation on Category page

wordpress,category,custom-post-type
I've got two custom post types, for example 'Cars' and 'Bikes'. I've used Wordpress's default category to categorise the posts from the two post types. Let's say for example the categories are 'Red', 'Blue' and 'Black'. What I'm trying to achieve here is that when I go to the category...

Adding two value to WP custom fields

html,css,wordpress,custom-post-type
I have a custom-field applied to specific posts, but I want to add two values to one field. How do I do that from the admin side? CSS .post-1 { text-align: left; padding-left: 50px; background-position: left center; float: left; } I want to add '.bgAlign' class to the value of...

Custom post type pagination not working

wordpress,pagination,custom-post-type
I know this has been asked a thousand times, and I have tried to replicate almost all the solutions I found either here, or into the Wordpress forums (where I posted a question too) but nothing seems to solve my problem. I have created a theme from scratch, I downloaded...

Target the next ID inside the Loop (WP)

wordpress,custom-post-type
Is it possible to target the next section inside the loop? so that it will scroll down to the next section area. Here is my code: <section id ="<?php echo $postid; ?>" class="subpage-wrapper fullscreen background parallax" style="background-image: url('<?php echo $image[0]; ?>')" data-img-width="1400" data-img-height="717" data-diff="100" data-oriz-pos="100%"> <a href="#<?php echo $postid; ?>"...

Wordpress custom post types for different styled paragraphs

php,wordpress,wordpress-theming,custom-post-type,custom-wordpress-pages
My homepage has content that look's something like: <section id="about"> <p class="quote"> </p> <div class="text"> <h2></h2> <p></p> </div> </section> <section id="about-photo"> <div class="image"> <img src="" alt=""> </div> </section> <section id="mission"> <div class="text"> <h2></h2> <p></p> </div> </section> I was wondering whether the way to reproduce this structure in a CMS would...

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

php,wordpress,custom-post-type,posts
I have an 'events' post type. I have another category called 'Speakers' and it has posts which are speakers. When creating an event I need to select the speakers for each event through backend. I need to give an interface so that the admin could select the speakers for the...

How to display custom post type in a submenu?

menu,wordpress-plugin-dev,custom-post-type
I am adding a submenu named as "Articles" using add_submenu_page() under a custom menu. I want to display the custom post type="page_article" in this "Articles" submenu. Whenever I click on Articles submenu , it should redirect me to "edit.php?post_type="page_article". I have tried with wp_redirect in callback function of add_submenu_page, but...

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

wordpress,custom-post-type
I'm registering multiple custom post types. One is 'news', the second is lets say 'notification'. I'm registering both (and many others) with: news: $labels = .. // leaving this blank for SO, shouldn't be of importance $args = array( 'labels' => $labels, 'public' => true, 'publicly_queryable' => true, 'show_ui' =>...

How to show post formats in custom post types?

php,wordpress,wordpress-plugin,custom-post-type
I create custom post type in wordpress. but i also want to show post formats quote and image. where i choose post format quote or image. this is my custom post type code! function Quotes_sky() { $labels = array( 'name' => _x( 'Quotes', 'post type general name', 'your-plugin-textdomain' ), 'singular_name'...

WordPress Taxonomy get category

php,html,wordpress,custom-post-type
Hopefully an easy fix for someone! I have a custom post type, named 'products'. Using this code, I am getting the name of each 'product': <?php //Define your custom post type name in the arguments $args = array('post_type' => 'products'); //Define the loop based on arguments $loop = new WP_Query(...

Wordpress custom permalinks

wordpress,.htaccess,rewrite,custom-post-type,permalinks
I've been working on my wordpress permalinks for a couple of days and can't seem to figure out how to get them to work properly. Here is the simple version of what i have and what i'm trying to achieve I have 5 different categories (home, sports, beauty, arts, food)...

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
I have written a piece of code to build a paginated archive page for a custom post type. I cannot exclude a certain custom taxonomy. can anyone help, please? $temp = $wp_query; $wp_query = null; $wp_query = new WP_Query(); $wp_query->query('showposts=30&post_type=my_custom_post_type'.'&paged='.$paged); ...

WP navigation post of a custom post type

php,wordpress,custom-post-type
I need to include in single.php a navigation buttons with previous and next post of the custom post type called 'works'. I include this <?php echo get_next_posts_link('Go to next post'); ?> <?php echo get_previous_posts_link('Go to prev post');?> or this <?php previous_post_link( $taxonomy = 'works' ); ?> But don´t show nothing...

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

wordpress,custom-post-type,permalinks,posts
I want to hide permalink section under title of a post for a particular post type in wordpress. How can I do that? Anyone please help..

Display post from custom post type

php,wordpress,custom-post-type,wordpress-loop
I have this Custom Post Type (CPT) defined at functions.php: register_post_type( 'opinion', array( 'label' => __( 'Opiniones' ), 'singular_label' => __( 'Opinión' ), 'labels' => $labels, 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'menu_position' => 2, 'hierarchical' => false, 'rewrite' => array( 'slug' => 'opinion', 'with_front' => true...

get_option intermittently fail WordPress

php,mysql,wordpress,custom-post-type
This is my first question. I have a custom taxonomy set up in a theme inside a functions.php file. I've added some extra meta fields for the custom taxonomy (category), also set through the functions.php file. I am using the update_option() function. Here is the part that is saving the...

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

wordpress,custom-post-type,custom-taxonomy
I've built a plugin that has a decent amount of users. I've built it based on number of examples here and there + the mighty codex. I'm using a custom post type to store values and reuse them in the front end to display stuff. Some time ago, I noticed...

Delete metadata in WP admin custom columns

wordpress,custom-post-type
I want to delete metadata from the admin panel of my custom post in WP. I created my custom column and display the desired metadata inside but when I try to create a button to delete the metadata nothing happens. My code tries to delete the metadata and user post...

Feature thumbnails for specific custom post types

wordpress,thumbnails,custom-post-type
Its pretty simple i think, but i dont find anything about it.. i'd like to feature thumbnails for my three post types, i please you guys to help me. add_theme_support( 'post-thumbnails', array( 'crew', 'staff' , 'guest') ); add_action( 'init', 'create_post_type' ); function create_post_type() { register_post_type( 'crew', array( 'labels' => array(...

Custom Loop Pagination in Wordpress

wordpress,pagination,custom-post-type
im using this custom loop within a wordpress page. It works great (although it has been simplified here). However, it displays 100's of search results on one page. Because it is a custom loop, i am struggling to get it to work with some pagination (ideally 10 per page). Has...

Change upload_dir folder at a certain cpt but cant change back

wordpress,upload,wordpress-plugin,wordpress-plugin-dev,custom-post-type
im try something with the upload_dir filter I check the current CPT with this function function get_current_post_type() { global $post, $typenow, $current_screen; //we have a post so we can just get the post type from that if ( $post && $post->post_type ) { return $post->post_type; } //check the global $typenow...