We are unable to update a website because the SuperCPT plugin breaks whenever we do. It’s not actually the plugin itself, but code that uses the plugin.
You’ll see the issue on the site copy admin page (during the upgrade). We have left it broken here:
https://sitecopy.empirecenter.org/wp-admin/
The error it throws is:
Fatal error: Class ‘Super_Custom_Post_Type’ not found in /home/empirecenter/www/sitecopy/wp-content/mu-plugins/Empire_Center/Init/Post_Types_Taxonomies.php on line 6
It is caused by custom code written in a theme file. (This is not the actual site theme – but files just housed in a theme folder.) Below is the code in its entirety. Can you please let us know what we should do here so that we can successfully upgrade this website without this breaking? Thanks!
add_action(‘after_setup_theme’, ‘ec_setup_post_types_taxonomies’);
function ec_setup_post_types_taxonomies() {
$publications = new Super_Custom_Post_Type(ec_prefix(‘publication’),
‘Publication’,
‘Publications’,
array( ‘has_archive’=> true, ‘rewrite’ => array(‘slug’ => ‘publications’), ‘supports’ => array( ‘title’, ‘editor’, ‘thumbnail’, ‘revisions’, ‘excerpt’, ‘page-attributes’, ‘author’)));
$publications->set_icon(‘book’);
$ny_torch_posts = new Super_Custom_Post_Type(ec_prefix(‘ny-torch-post’), ‘NY Torch Post’, ‘NY Torch Posts’, array( ‘has_archive’=> true, ‘supports’ => array( ‘title’, ‘editor’, ‘thumbnail’, ‘revisions’, ‘excerpt’, ‘page-attributes’, ‘author’ ) ) );
$ny_torch_posts->set_icon(‘fire’);
$tax_tags = new Super_Custom_Taxonomy(ec_prefix(‘tag’), ‘Tag’, ‘Tags’);
$tax_torch_tags = new Super_Custom_Taxonomy(ec_prefix(‘torch_tag’), ‘NY Torch Tag’, ‘NY Torch Tags’);
$tax_cats = new Super_Custom_Taxonomy(ec_prefix(‘category’), ‘Category’, ‘Categories’, ‘category’);
//$tax_pub_issue_areas = new Super_Custom_Taxonomy(ec_prefix(‘pub-issue-area’), ‘Issue Area’, ‘Issue Areas’);
$data = new Super_Custom_Post_Type(ec_prefix(‘data’), ‘Data’, ‘Data’, array( ‘has_archive’=> true, ‘supports’ => array( ‘title’, ‘editor’, ‘thumbnail’, ‘revisions’, ‘excerpt’, ‘page-attributes’, ‘author’ ) ) );
$data->set_icon(‘picture’);
//connect_types_and_taxes($publications, array($tax_tags, $tax_cats, $tax_pub_issue_areas));
connect_types_and_taxes($publications, array($tax_tags, $tax_cats));
connect_types_and_taxes($ny_torch_posts, array($tax_tags));
connect_types_and_taxes($data, array($tax_tags));
}
]]>When I add a url to the field type meta box and click save on the edit screen for the cpt, it clears the url.
Any idea why that would be happening? Its on my local using Desktopserver if that matters?
Thanks !
]]>I currently have one CPT called locations. I need to be able to add a couple of state categories to better organize the locations but I cannot add any new taxonomies or meta boxes. I can create a new CPT with taxonomies and meta boxes but I cannot add them to the existing CPT I made. I cant even change set_icon on my existing CPT, only new ones.
]]>I have created my custom post type (projects) and taxonomy (project_category).
I would like to add an option to my metabox that displays on “page” posts that shows a list of the project_category so that one can be selected
I’ve created the following to grab a list of the terms, printing the array front end shows the desired results but when it’s used in the page meta box the array is empty at this stage. how can I trigger the page meta box after the project categories have been created?
// Grab List of Project Categories
$project_category_list = array();
$cats_args = array( 'orderby' => 'name', 'hide_empty' => false );
$project_cats_obj = get_terms( 'project_category', $cats_args );
foreach ($project_cats_obj as $term ) {
$project_category_list[$term->slug] = $term->name;
}
]]>
On first creation of a new CPT entry the editor throws an error above each custom post type form entry point, reading something like
Notice: Undefined index: default in C:\xampp\htdocs\scevent\wp-content\plugins\super-cpt\includes\class-super-custom-post-meta.php on line 298
Once a new post is saved even if it only includes the title line than on revisiting the item in the editor the notice disappears.
Is there a workaround or hot fix? him
]]>I’m trying to figure out how these filters work and i could understand many of them but this:
scpt_plugin_meta_field_callback
When i use it, like this "add_filter('scpt_plugin_meta_field_callback',array( $this, "add_wysiwyg2_field" ),10,2);"
the callback function outputs for all other fields. What am i doing wrong?
]]>I created a custom post type and a custom taxonomy. Then I connected this custom taxonomy with that custom post type.
Is there a way to show taxonomy values in a select multiple way?
]]>How do I the HTML5 attribute required to my textbox?
]]>I’m assuming this plugin doesn’t have server side field validation.
Anyone have a solution or suggestions for field validation?
]]>Hello, sorry if this is very simple but I am a little new. Thanks for all the work on the plugin its helping me a lot.
I want to print all the values for a checkbox, but the following code only prints the first value checked in the meta box. What could I add to echo all of the values in a list?
‘services’ => array( ‘type’ => ‘checkbox’, ‘options’ => array( ‘Piano Moving’, ‘Packing’, ‘Cleaning Services’ ) ),
]]>how can i populate a select input with the data of taxonomy? here is a of my sample code
$positions->add_meta_box( array( ‘id’ => ‘details’, ‘context’ => ‘normal’, ‘fields’ => array( ‘title’ => array( ‘label’ => false, ‘placeholder’ => ‘Enter title here’ ), ‘department’ => array( ‘type’ => ‘select’, ‘data’ => ‘department’ ) ), ) );
firstly i created a taxonomy department which i want to show the data in a select input inside a metabox.
I find it working with a post type post if i change the value of the data to ‘data’ => ‘post’ all the existing post is showing in the dropdown but its not working for taxonomy. Please help me
Love this plugin.
In wordpress 3.8 on chrome I’m getting a broken image (https://none) in the admin sidebar on the SuperCPT’s that have custom images. Here’s a screenshot.
WYSIWYG Editor custom meta isn’t working properly on WordPress 3.8?
]]>Firstly, THANK YOU for this amazing plugin. You have saved me literally hours of time.
However, I’m having trouble returning dates before 1970 using the helper functions:
$startdateymd = date('Y-m-d', get_scpt_formatted_meta( 'event-start-date' ));
This returns the date of 1549/07/09 as 1970/01/01. Is this because of the way the timestamp is being generated by get_scpt_formatted_meta? Is there a workaround?
I also have a select which is returning the ID instead of the value:
$startdatetype = get_scpt_formatted_meta( 'event-start-date-type' );
Is there a way of returning the value instead of the ID?
Thanks again.
]]>Hi,
In the dashboard, the search input do not return anythong from the meta field. Is that normal ?
Regards,
]]>Hello,
Thanks for this plugin, very useful!
I create a custom post type called “question” with this code in my function.php :
// function that creates the questions custom blog post with the SuperCPT plugin
function add_questions_post_type_question() {
// we check if SuperCPT is installed
if ( ! class_exists( 'Super_Custom_Post_Type' ) )
return;
// creation of a new SuperCPT object for the questions
$question = new Super_Custom_Post_Type( 'question' );
// we set the icon for the custom question blog post
$question->set_icon( 'question' );
// Taxonomy test, should be like tags
$tax_tags = new Super_Custom_Taxonomy( 'Question Tag' );
// Taxonomy test, should be like categories
//$tax_cats = new Super_Custom_Taxonomy( 'tax-cat', 'Tax Cat', 'Tax Cats', 'category' );
$tax_cats = new Super_Custom_Taxonomy( 'tax-cat', 'Category', 'Categories', 'category' );
// Connect both of the above taxonomies with the post type
connect_types_and_taxes( $question, array( $tax_tags, $tax_cats ) );
// Add a meta box with every field type
$question->add_meta_box( array(
'id' => 'Question informations',
'context' => 'normal',
'fields' => array(
'Author' => array( 'type' => 'select', 'options' => array( 1 => 'Name 1', 2 => 'Name 2', 3 => 'Name 3', 4 => 'Name 4', 5 => 'Name 5' ) ),
'Other Author (if author is not listed above)' => array(),
'Date' => array()
)
) );
}
[Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]
When I am editing my question, I want to add tags. It works fine, but the feature choose from most used tag is not working : I can see the link in the backoffice but when I click, nothing happens. When I go in the tag list, all my tags are here.
Does anybody had the same issue ?
]]>I’m using Post Relationships this way:
'areas' => array( 'type' => 'select', 'label' => '', 'data' => 'area', 'multiple' => 'multiple' ),
In this case, area is a custom post type. And I add this line inside add_meta_box for a custom post type called books.
How can I show selected area title for each book? I’m trying using wp_query but have no results.
]]>i added custom fields to my normal post
and delete the link of post type with :
$movies->cpt['rewrite'] = array( 'with_front' => false, 'slug' => '/' );
its ok with normal permalink :
https://localhost/wp/?p=123
but when change the permalink to any other, i get 404 not found .
note : i use wordpres on my localhost
thanks a lot, but i have some questions :
1- how i can use media and browse my media into my site ?
i used this code
`<img src=”<?php echo get_post_meta($post->ID, ‘media’ , true); ?>” />
but noting show .
2- how i can add keywords and categories for this custom posts?
3- how i can change a language of lables (Add new , set media , etc…)
thanks
]]>Maybe a stupid question, but how can i display a date field? It outputs a long number like : 1383004800. Think this is an unformatted way but not sure how to fix it.
Hope someone can help.
]]>Super CPT is breaking the ability for you to add a field to a form through the admin. Im guessing its commented code or a no-conflict issue.
]]>I’m having a very strange problem that I cannot figure out. I’m really hoping you may have seen something like it before.
I created several CPTs and things were going well, then somewhere along the way I can no longer access my static pages. It didn’t start out that way, so I can’t imagine what happened. I know that when I first created my CPTs I could still access my pages.
What I have found is that when I have my permalinks set to Post Name (what I have had set from the beginning), my CPT pages work fine but my static pages redirect to my home page. When I change the Permalinks to the default I can access all my pages. If I set the Permalinks back to Post Name, once again I can only access my CPT pages, but my static pages redirect to my home page.
This is driving me crazy. Perhaps I need something changed in my htaccess or config files, but I cannot figure out what it is.
I hope you may have seen something like this before to help guide me. Unfortunately my site is not live (it’s under maintenance mode) so I cannot show you what I mean.
]]>I create a custom taxonomy like that:
$areas = new Super_Custom_Taxonomy('area', 'área', 'áreas', 'cat');
$areas->show_admin_column (true);
But I can’t see the values on the post type table.
]]>When in the single post template, I want to be able to have a link back to the parent category. For example, if viewing equipment in the cranes gategory, then a “Back to Cranes” link. I can see that with custom post types, this doesn’t work in the usual way, is that correct? How can I get the category name and its link?
Thanks.
I made a custom template for my custom post type called archive-bc_equipment.php and it is not being called; archive.php is still called. On the other hand, single-bc_equipment.php does work. Any help is appreciated.
Here is the relevant code.
<?php
define('MU_PLUGIN_PATH', ABSPATH . 'wp-content/mu-plugins');
define('BC_PREFIX', 'bc_');
function bc_prefix($string='', $safe=true) {
if (!$safe) {
return BC_PREFIX . $string;
} else {
return (strpos($string, BC_PREFIX) === 0) ? $string : BC_PREFIX . $string;
}
}
require(MU_PLUGIN_PATH . '/super-cpt/super-cpt.php');
add_action('after_setup_theme', 'bc_setup_post_types_taxonomies');
function bc_setup_post_types_taxonomies() {
$equipment = new Super_Custom_Post_Type(bc_prefix('equipment'), 'Equipment', 'Equipment', array('rewrite' => array('slug' => 'equipment-fleet')));
$equipment_cat = new Super_Custom_Taxonomy(bc_prefix('category'), 'Category', 'Categories', 'category', array('rewrite' => array('slug' => 'equipment-category')));
connect_types_and_taxes($equipment, array($equipment_cat));
}
]]>
I am having some trouble with a client not being able to see the custom post types in the Appearance => Menu section. I can see all post types listed (I am administrator), but he cannot. He only sees the following (Pages, Links and Categories). He is assigned Administrator role as well. Has anyone ever had this trouble and are there certain parameters i should be setting on my post types for these to appear correctly?
]]>I’ve already seen this page about your filters and actions but there aren’t any examples. Could you give me any directions on how to use this filter (scpt_plugin_{$this->type}_meta_save_{$field}) for example?
I’m trying to use like this:
$superCustomCPT = new Super_Custom_Post_Type('mycustomcpt');
$superProductCPT = new Super_Custom_Post_Type('product');
$superProductCPT->add_meta_box(array(
'id' => 'attribute_groups',
'title' => 'My title',
'fields' => array(
'prod_attribute_groups' => array( 'type' => 'checkbox', 'label' => false, 'data' => 'mycustomcpt', 'multiple' => 'multiple' )
)
));
function test($test){
_log('asdasd');
_log(print_r($test,true));
}
add_filter('scpt_plugin_product_meta_save_attribute_groups','test');
But this error is showing up: Undefined index: ‘attribute_groups’
]]>Again great plugin.
I am having an issue using single-services.php with services as my cpt name to display. It get a 404.
Though, I do have a page called services that I am using with a template page to display the cpt services and that works fine.
my single-services.php will be customize, but right now I am trying to get a generic result such similar to the default single.php
]]>I am using this plugin and everything seems to work fine, but I am not able to display my custom meta box field for some reason. Can anyone take a look at my code incase I am overlooking at it?
Thanks
[code]
<?php
function scpt_cms() {
if ( ! class_exists( 'Super_Custom_Post_Type' ) )
return;
// Create custom post types Services
$services = new Super_Custom_Post_Type( 'services' );
$services->set_icon( 'cogwheels' );
$services->add_meta_box( array(
'id' => 'basic-information',
'context' => 'side',
'fields' => array(
'cost' => array(),
'category' => array( 'type' => 'radio', 'options' => array( 'All', 'WordPress', 'Drupal', 'Joomla!', 'Zen Cart', 'Magento' ) ),
)
) );
$orders = new Super_Custom_Post_Type( 'order' );
}
add_action( 'after_setup_theme', 'scpt_cms' );[/code]
and I display the cpt with the following
[code]
$args = array( 'post_type' => array('services'),
'posts_per_page' => -1 );
$loop = new WP_Query( $args );
if ( have_posts() ) :
$count = 0;
/* Start the Loop */
while ( $loop->have_posts() ) : $loop->the_post();
$count++;
if ($count <= 1) :
/* Include the post format-specific template for the content. If you want to
* this in a child theme then include a file called called content-___.php
* (where ___ is the post format) and that will be used instead.
*/ ?>
<div class="service">
<header class="entry-header">
<?php the_post_thumbnail(); ?>
<h2 class="entry-title"> " title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentytwelve' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark">
<?php if ( get_post_meta( $post->ID, 'category', true ) ) : ?>
<?php echo get_post_meta( get_the_ID(), 'ccategory', true ) ?>
<?php endif; ?>
<?php echo get_post_meta($post->ID, "category", true); ?>
<?php the_title(); ?>
</h2>
</header>
<!-- .entry-header -->
</div>
<!-- #post -->
<?php endif;
endwhile;
endif; ?>
[/code]
everything works, but doesn’t display the meta keys. everything is OK from the dashboard.
Help please need this urgently.
Firstly i would like to congrat you. It′s an amazing idea!
Is it possible to extend any of your classes? “Super_Custom_Post_Type”, “Super_Custom_Taxonomy” and possibly a class for meta boxes?
If this is possible it would be great because i could override functionalities and develop custom things
]]>