custom-post-type

WP Query post by year in accordion

99封情书 提交于 2021-01-28 07:53:35
问题 I'm trying to get the testimonials (custom post type) in following order. I can easily retrieve posts using WP_Query class but struggling to create an accordion as shown in the screenshot above. 回答1: Try using a custom select query and looping through each post with a post_type of testimonial. Then loop through result and set WP_Query() class date_query param to an array of the years obtained by the custom select query result. global $wpdb; $posts = $wpdb->posts; //Get all unique years as

Radio buttons for custom post type categories from shortcode comma separated value

无人久伴 提交于 2021-01-07 03:01:08
问题 I have created a custom post type. Everything works fine with a shortcode like this [program] Now I would like to be able to create a shortcode like this [program category="category_1,category_2,category_3"] All those categories slugs from the shortcode have to appear in a radio button filter with the categorie name. Its working with only one category in the shortcode but once they're more and with commas it doesn't. <?php function program_shortcode( $atts ) { ob_start(); extract( shortcode

Radio buttons for custom post type categories from shortcode comma separated value

假如想象 提交于 2021-01-07 02:59:43
问题 I have created a custom post type. Everything works fine with a shortcode like this [program] Now I would like to be able to create a shortcode like this [program category="category_1,category_2,category_3"] All those categories slugs from the shortcode have to appear in a radio button filter with the categorie name. Its working with only one category in the shortcode but once they're more and with commas it doesn't. <?php function program_shortcode( $atts ) { ob_start(); extract( shortcode

Radio buttons for custom post type categories from shortcode comma separated value

帅比萌擦擦* 提交于 2021-01-07 02:59:08
问题 I have created a custom post type. Everything works fine with a shortcode like this [program] Now I would like to be able to create a shortcode like this [program category="category_1,category_2,category_3"] All those categories slugs from the shortcode have to appear in a radio button filter with the categorie name. Its working with only one category in the shortcode but once they're more and with commas it doesn't. <?php function program_shortcode( $atts ) { ob_start(); extract( shortcode

How to add or use category template for custom post type

拟墨画扇 提交于 2020-07-23 08:01:08
问题 I would like to create a unique design category for my custom post type. Here I get it design for main post type but the same design not applying for the category pages it takes to the default category page. My Custom Post Type name resources for that I create a separate designed template archive-resources.php , so it's working fine but for custom post category page I tried in many ways but still I won't get the result (created separate Taxonomy like category-resources.php ) but still not

Wordpress custom post type capabilities, admin can't edit post type

谁说我不能喝 提交于 2020-06-25 05:46:30
问题 I'm having a wired problem with WordPress. Below is my code for an events post type, it works without the capabilities but when the capabilities are added all the default roles (admin, editor, etc...) cant use the post type. The admin role is only able to see the custom taxonomies. I have a custom user role with "edit_events => true" for the user role that is able to submit events for review. This is what I want, but the built in roles can't see the post type! I've tried just about every

Upload multiple featured images in a custom post (Wordpress)

大兔子大兔子 提交于 2020-04-29 06:47:51
问题 I have a custom post and I would like to upload many featured images. I know there are some plugins doing that but I would like to try it without installing a plugin. Is it possible? Any help/opinion is appreciated 回答1: Well, there is only ONE featured image. But you could create a custom meta box where you could add new images. Here's an example using the wordpress uploader: functions.php or my-plugin.php : //init the meta box add_action( 'after_setup_theme', 'custom_postimage_setup' );

Upload multiple featured images in a custom post (Wordpress)

梦想与她 提交于 2020-04-29 06:46:28
问题 I have a custom post and I would like to upload many featured images. I know there are some plugins doing that but I would like to try it without installing a plugin. Is it possible? Any help/opinion is appreciated 回答1: Well, there is only ONE featured image. But you could create a custom meta box where you could add new images. Here's an example using the wordpress uploader: functions.php or my-plugin.php : //init the meta box add_action( 'after_setup_theme', 'custom_postimage_setup' );

Wordpress: Permanently deleting custom post type post. remove the: “1 post moved to the Trash. Undo” message

谁说胖子不能爱 提交于 2020-03-23 02:02:52
问题 Sorry if there is already an answer to this but I couldn't find it. So I have this script that permanently deletes a post from a custom post type. It does permanently delete the post. but after it's deleted I get this message: But I want this message gone because even if u the press undo button it just says: the code for deleting the posts is: function members_skip_trash($post_id) { if (get_post_type($post_id) == 'members') { // Force delete wp_delete_post( $post_id, true ); } } add_action(

Wordpress: Permanently deleting custom post type post. remove the: “1 post moved to the Trash. Undo” message

点点圈 提交于 2020-03-23 02:02:04
问题 Sorry if there is already an answer to this but I couldn't find it. So I have this script that permanently deletes a post from a custom post type. It does permanently delete the post. but after it's deleted I get this message: But I want this message gone because even if u the press undo button it just says: the code for deleting the posts is: function members_skip_trash($post_id) { if (get_post_type($post_id) == 'members') { // Force delete wp_delete_post( $post_id, true ); } } add_action(