Ross Wintle
Forum Replies Created
-
Marking as resolved.
Ah yes. I was already logged in to forums and didn’t realise I had to log in again to edit the codex. I was looking for an edit button that wasn’t there. Done!
Thanks for your help esmi!
Ross
Neither is it mentioned…that you shouldn’t use post, page or attachment as names for your CPTs.
Well, I’m gonna have to disagree with that statement: http://codex.wordpress.org/Function_Reference/register_post_type
Look, I spent about 2 hours debugging this last night. I’ve taken time to post a detailed explanation here this afternoon. I’m just trying to save someone else the hassle of having to do the same work again.
If you think this is a “reserved term” and not an issue with the core can we just add it to the list? Can I submit a change to the codex somehow? What should I do?
Well, yes. I’m going to change my code to do that. But my point is that if “action” isn’t listed in the codex as an identifier that you shouldn’t use (and, as far as I can tell, it’s not) then I should be able to use it, and I can’t.
So either:
– I’m not looking in the right place in the codex; OR
– codex needs updating to list “action” as an invalid post type name; OR
– codex is right, I should be able to use it, and core needs fixing.Could use:
a) validation that calling a post type “action” breaks things the dashboard post search
b) some direction on how to get either codex or core fixedThanks
I’m not necessarily saying it’s a problem with core. It might just be that the documentation needs updating.
It may well be that it’s my “issue with my theme” for naming my post type “action”, but I’m not aware of anywhere that tells me that calling a post type “action” is a bad thing to do.
The alternative view is that calling a post type “action” shouldn’t cause this problem, in which case, something in the core is broken.
In case you’re wondering, the process I went through with diagnosis was:
– disable plugins one-by-one (error still present with no plugins enabled)
– change theme (error no longer present)
– change back to my custom theme (error re-appears)
– scan theme code for filters that might affect the query (like pre_get_posts – no filters present)
– disable PHP includes one-by-one (each CPT and custom widget is in a PHP include)
– eventually find that post type called “action” was the issue.I’m a pretty experienced dev, I’ve used CPT’s a lot, and this is the first time I’ve come across this issue. But it IS an issue. I was hoping someone might validate it for me and let me know if I should raise it on trac or not.
Thanks
Ross
Minor correction in second code snippet – should be sprintf:
$url = get_post_meta( get_the_ID(), '_some_meta_var', true ); $link = sprintf('<a href="%s>%s</a>, $url, "My download"); if (class_exists('GA_Filter')) { $link = GA_Filter::the_content($link); }Oh, I should add that setting “Use visual editor” to “No” makes the description field appear again, so this only applies when using the visual editor.
I’ve checked the generated HTML source and there is some editor markup there, but some of the elements have style=”display: none” on them.
There are no JavaScript errors.
Thanks
Thanks for the update @aglonwl !
There’s a new thread about the bp_is_active issue.
See http://wordpress.org/support/topic/plugin-events-manager-upgrade-52-fatal-error-bp_is_active where I’ve posted a quick fix.
A quick fix is to change line 3 of wp-content/plugins/events-manager/templates/forms/event/group.php to
if( !function_exists('bp_is_active') || !bp_is_active('groups') ) return false;Yeah, I’ve got this too on the event submission form. Can we get a patch out ASAP?
Forum: Fixing WordPress
In reply to: Help get image link title in this functionHi there,
I wrote the original post that @dbirider referred to – this problem has been pointed out in a comment.
He’s right, and my regular expression is probably the culprit. The
.*is “greedy”. This means that if the$imagevariable contains a tag like:<a href=''http://mysite.com/path/image.jpg'' title=''Image title''>then it will match (and therefore replace) everything between the first quote mark and the last quote mark. In fact, if you’re image tag was using single quote marks for the src attribute, instead of double quote marks, it would delete the image too!!
An alternative, better, dare I say RIGHT fix to my snippet would be to make the
.*in the regular expression “lazy”, by changing it to.*?. So the preg_replace line becomes:$new_content = preg_replace('/href=\'(.*?)\'/', 'href=\'' . $image[0] . '\' title="'.$post_title.'"/', $content );I’ve not tested this but you’re welcome to give it a go.
I’ll update my post too. Thanks for raising this, and to @keesiemeijer for the fix.
Forum: Plugins
In reply to: [Plugin: Events Manager]Give single events a parentSorry to bump – I want to do this too. Been using the plugin for ages and just realised that since the post started using post types the single event pages set class=”… current_page_parent …” on the home/blog page.
Could you not add an option to have a page used as the parent menu item for the events type and then filter on the nav_menu_css_class hook?
Something like (code probably not quite correct):
add_filter('nav_menu_css_class', 'em_nav_class', 10, 2 ); function em_nav_class($classes, $item) { $post_type = get_post_type(); if ($item->object_id == [new_option_value]) { array_push($classes, 'current_page_parent'); }; return $classes; }Forum: Plugins
In reply to: [Options Framework] [Plugin: Options Framework] wpautop not workingOh, OK. Fixed this.
Didn’t realise that wpautop intentionally stores data in database without <p> tags (apparently?), and you need to apply filters to the option to get <p>’s added back in…something like:
echo apply_filters('the_content', of_get_option('front_page_text'));Forum: Plugins
In reply to: [Twitter Widget Pro] Twitter Widget Pro Still not UpdatingAh, just realised that I didn’t update this thread with a note about my modified version that may fix this issue.
I’ve put a modified version of the plugin up on my work blog, in the entry that describes the issue that I discovered. Feel free to download it and give it a try.
http://oikos.org.uk/2012/03/tech-notes-twitter-widget-pro-not-updating-for-heart-internet-users/