I need to define a custom support feature for my WordPress Plugin but I can't find how to do so. What I want to do is to display a box on certain custom post type containing 2 meta fields in which users can type in Longitude and Latitudes values for geolocalisation purposes. For practical uses, i want to attach this custom feature the same way as supports are to posts : <?php $args = array( ... ... 'supports' => array('title','editor', …
I am making my first WordPress theme and I am trying to assign a page template to my custom post type automatically. (i.e page-slug.php) As an example: you can make a page file in WordPress called page-events.php and then when you create a page called Events, it will automatically select this template to use instead of you having to go into the page and manually select the template. I have made a custom post type 'Products' and I want to …
How do I add support for excerpts for post categories in the admin? I have tried the following, but to no avail: add_post_type_support('category', 'excerpt'); add_post_type_support('post_category', 'excerpt'); add_post_type_support('taxonomy', 'excerpt'); It's got to be something like this, but I just don't know.
I'm trying to get all the post types that has tags functionality. I searched a lot but couldn't find a conditional or something for that. I need a way to get post types or post objects for the posts which are taggable. Here are my current code to get post types: public function getPostTypes() { $excludes = array('attachment'); $postTypes = get_post_types( array( 'public' => true, ), 'names' ); foreach ($excludes as $exclude) { unset($postTypes[$exclude]); } return array_values($postTypes); } Thanks!
I'm a new user of WP, i have create 6 customs post type where i can change parameters of them in the functions.php of my personnal theme. I can change 'supports' and 'slug'. On my url if i put my cpt label like mysite.fr/editos/ i got the list of my all cpt edito post. I want to use the default post type of WP which is "post", but i want to change the 'supports' and 'slug' and get the same …
I want to change labels in this page ex: Client -> Owner What is the file name where I can change these labels from? screenshot: https://snag.gy/75oUTb.jpg I tried to do it by javascript, but it caused effect on all website pages, on previewing, editing or updating, the page turns to white. This is my piece of code echo "<script type='text/javascript'> window.onload = replaceTxt; function replaceTxt() { var vr1 = document.getElementById('_bunch_bunch_projects_settings[client]').childNodes[1].childNodes[1].innerHTML; var vr11 = vr1.replace('Client','Owner'); } </script>";
I am trying to retrieve a list including both builtin and custom post types: $post_types = get_post_types(array( 'public' => TRUE, ), 'objects'); The above almost works, but I would like to exclude the attachment from this list, only returning post types with specific support such as editor, title and thumbnail. Is this possible?
Below code removes the medial button from other editors as well.. how to remove the editor from the post type support editor add_action('admin_head', 'remove_mediabuttons'); function remove_mediabuttons() { global $post; if($post->post_type == 'custom_post_type' && current_user_can('edit_post') ) { remove_action( 'media_buttons', 'media_buttons' ); } }
I am using 'author' in 'supports' array for my 'custom post type', that shows a list of all users of the site on add or edit post screen to assign author for the post. But I want to filter that list to a role. How can I filter authors list for a particular role? I don't want to show a long list of users there. Thanks in advance.
'supports' => array('title','author','post-formats'), Now display all types of post-formats but i want to display only selected. like : link,audio,video
I have registered a new post type and made a custom template to display it. According to WP´s latest support for CPT templates, all it takes to make it available for any given CPT is to place this header on the template file: /** * Template Name: Single Book * Template Post Type: book */ Then, following the template hierarchy, I named my template single-book.php. And alright, now I have this template available for the 'book' post type. It works. …
I am currently working on my first WP site and struggeling with something. My websites should allow the admins nor moderators to upload tutoring videos related to series. I want that each series will be related to "lesson category". For example, there will be a "Mathematics" category and under this category the moderators should be able to add series like "Linear Math - Fall", "Algebra - Winter", "Algebra - Fall" etc. In addition, I would like to link between a …
My site is using a plugin for displaying an archive widget. It only displays the 'post' post-type. I currently have three different post-types. Looking through the code I found: $where = apply_filters( 'getarchives_where', "WHERE post_type = 'post' AND post_status = 'publish' AND post_date <= now()" ); It seemed like a easy fix. First I changed WHERE post_type = 'post' to WHERE post_type = 'privacy, security' but that didn't work. Then I did WHERE post_type => array('privacy', 'security') AND post_status = …
A fresh wordpress install has the following post types: Post (Post Type: 'post') Page (Post Type: 'page') Attachment (Post Type: 'attachment') Revision (Post Type: 'revision') Navigation Menu (Post Type: 'nav_menu_item') Custom CSS (Post Type: 'custom_css') Changesets (Post Type: 'customize_changeset') https://codex.wordpress.org/Post_Types doesn't address what the final two are used for. Could anyone explain?
Hi everyone! I have the design of my web and there's a page that it should look like this. I don't know if this is the good way to do it but I'm trying to make custom types that show like "post", and every post should be a table. I tried to write it by myself, with plugins... but nothin works. I don't know why it doesn't show. I made my theme from 0 myself and I think I´'m writting …
I am trying to add the supports parameter to my custom post type but it is not working and renders the editing page blank: add_action( 'init', 'create_post_type' ); function create_post_type() { register_post_type( 'my_campaigns', array( 'labels' => array( 'name' => __( 'Campaigns' ), 'singular_name' => __( 'Campaign' ) ), 'supports' => array( 'title' => true, 'editor' => true, 'thumbnail' => true ), ) ); }
it's my first question on Stack network so let me know if something wrong in the use of this. I have a theme with these pieces of code: /** * Get the Featured image URL of a post * @global object $post * @param int $post_id * @return string */ function kleo_get_post_thumbnail_url( $post_id = null ) { $image_url = ''; $thumb = get_post_thumbnail_id( $post_id ); //all good. we have a featured image $featured_image_url = wp_get_attachment_url( $thumb ); if ( $featured_image_url …
I've created a custom post type. add_action( 'init', 'my_custom_post_type' ); function my_custom_post_type() { register_post_type( 'my_custom_post_type', array( 'labels' => array( 'name' => __( 'custom Posts' ), 'singular_name' => __( 'custom Post' ) ), 'public' => true, 'has_archive' => true, 'capability_type' => array("custom Post", "custom Posts"), 'map_meta_cap' => true, 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'comments' ) ) ); } If I add any images on the editor it displays as it is on the front end. but If add any …
Is there a easy non-css-hacking way to hide the default post body field in the dashboard? I simply want to have the title field and some adv. custom fields but remove the default post body field.
I am looking to set up 2 custom post types - Publicity & Management What I would like to do is display the featured thumbnail for each post from the custom post type on the Publicity page. These will then link though to each post using a custom template. I would like to do the exact same for the Management section. I have created the post type, but when I click on the thumbnails I am being taken to a …