Tim Smith
Forum Replies Created
-
You must have wanted something different. This is about disabling the parts that using public=>false does not disable, and the filter I subsequently posted does that for the page analysis.
As I noted at the start:
I can’t find a filter to block Yoast SEO from being enabled for a particular custom post type, but setting up the custom post type up as public=>false does disable most but not all of the Yoast WP SEO functionality.To get rid of the publish box was much harder and I ended up with this
/* Remove Yoasts publish box which is output even when post is not public
* Hook this to current_screen, the first time $typenow is set up and before the publish box action
* Custom Type is not available on admin_init so his filter is no help
* Ridiculous hard graft to remove it as can’t get at the WPSEO_metabox instance either, so scan the wp filter store to track it down
*/
public static function creative_infusion_remove_yoast_seo(){
global $typenow, $wp_filter;
if ($typenow==’yourcustomposttype’ && isset($wp_filter[‘post_submitbox_misc_actions’][’10’])) {
$filters=$wp_filter[‘post_submitbox_misc_actions’][’10’];
foreach ($filters as $idx=>$data) {
$function=$data[‘function’][0];
if ( is_object($function) && is_a($function, ‘WPSEO_Metabox’) ) {
remove_action( ‘post_submitbox_misc_actions’, array( $function, ‘publish_box’ ) );
}
}
}
}
add_action(‘current_screen’, ‘creative_infusion_remove_yoast_seo’);Forum: Plugins
In reply to: [GPP Slideshow] 1.3.1 with WP 3.5 doesn't work with gallery shortcodeMy issue is very specific and remains.
Using [gallery] (old style shortcode with no IDs listed) on a wordpress page works with WP 3.5 in version 1.2.1, but does not work (i.e. displays the native WordPress gallery) in version 1.3.1
I presume you’re referring to the setting to disable caching for any page with GET variables rather than disabled everything.
I actually want caching on, I was just surprised that it was using legacy rather than PHP and wanted to check that was expected.
Thanks.
Sorry, his suggestion worked fine for me.
Do you have the same line number (40 in class-opengraph.php) or is it from a different place?
That’s fine, thanks for taking the time to answer. I did figure that your connection order by would take over (which incidentally works marvellously for the usual case of showing items related to ones on the page in question, just not for my use case here).
Is using each_connected on a WP_Query like that supported? If not I guess I’d need to figure out all the joins as well to even have access to the right columns for sorting.
BTW this plugin is indispensable and a masterful piece of work.
Further to my problem and for reference that each_connected approach I’m trying use on WP_Query is taken from scribu’s answer on http://wordpress.org/support/topic/plugin-posts-2-posts-how-to-call-two-post-types-connected-in-one-query
Any pointers gratefully received, even if it’s just a case of I’m doing it wrong and need to filter my own order by somehow, or (worst case redundant data method) set up a post meta as well and use tax queries to sort by it.
Forum: Plugins
In reply to: [Posts 2 Posts] [Plugin: Posts 2 Posts] Get conections in an archive pageTry changing $post to get_queried_object just to be sure you have the right type, but the best approach to find connections for each item on an archive page is to use the each_connected approach scribu outlines on https://github.com/scribu/wp-posts-to-posts/wiki/Looping-The-Loop
My comment is probably a red herring.
I traced our problem to a conflict between the Query Multiple Taxonomies and Posts 2 Posts plugins – it seems the wp admin doesn’t like the two plugins having different versions of the files in mustache and scb directories. Updating the files in QMT has resolved our issue.
Similar problem for us. As you we have no connections listed in metaboxes on CPT page in the admin, but listed on the tools page.
We do get them on the front end, both from a custom WP_Query and from a p2p_get_connections call. How are you accessing them on the front end?
I was also using the methods on the objects returned from each_connected() but they have gone, probably as a result of the changelog item which says “fixed each_connected() returning wrapped objects”.
i.e. I was using the get_title and get_permalink methods similar to thisforeach $post->connected as $connected : $connected->get_title(); $connected->get_permalink();Easy to change (the properties are there) but I’m wondering if that change has caused the issue in the admin.
Doh! Contrary to what I said in Goal(3), a much simpler way to do what I need in the admin is to add a filter on wpseo_use_page_analysis
`global $typenow;
if (‘post_type‘ == $typenow) {
return false;
} else {
return true;
}It’d still be more flexible if the actions and filters could be individually removed from a theme, and I think that means exposing the classes globally.
And I’m still not sure if it would be better to completely disable the plugin for a particular post type.
If you’re referring to the settings page under Media, then as that page has no screen options or contextual help those links do not appear.
All seems fine to me.
Well I’m not the plugin developer (the plugin author is jakemgold), but there is some information about a new version on http://www.get10up.com/blog/2011/05/secondary-html-content-3-0-preview/
He’s also tweeted that he was waiting for WP 3.3 to release it (http://twitter.com/jakemgold).
This was just a quick hack to keep me going in the mean time that I thought I’d share. Glad it helped π
It’s because WP 3.3 has changed the way they implement Tiny MCE, particularly it now uses exact id’s instead of picking up several blocks based on a class.
If you’re familiar with PHP/CSS/HMTL then the following is a quick fix (i.e. it is not perfect but is better than nothing).
Firstly can add a filter to secondary_content_page_editor
add_filter('tiny_mce_before_init', 'secondary_content_elements');And add the function
function secondary_content_elements($in) { $in['elements']=$in['elements'].', secondary_block_1'; return $in; }This only enables the first secondary content (I was only using one), just add 2-5 as you need.
To make it look better then add an extra class to the secondary_content div so that it becomes
<div class="secondary_content wp-editor-container tmce-active">
The tmce-active may not be necessary.and also add to the css for the inside div (currently it just zeroes the margin)
padding:0 !important; background:#fff;It’s not a perfect fix as that enables the tiny mce editor ONLY IF the page is loaded with Visual enabled on the Body. If you use HTML view you’ll need to change to Visual then reload the page to get the secondary html editor in tiny mce. It’s also pesty that the filer needs to list all the secondary blocks we need.
Forum: Hacks
In reply to: I can't remove capability from specific userI wanted to remove a capability from a user (leaving it in the role) as well and after a lot of experimenting and browsing through the WP core I have found this works:
$user->add_cap("publish_posts",false)What happens is that $user->add_cap() puts an entry into the user capability overrides and $user->remove_cap(), deletes an entry from the overrides. To actually remove a capability the user inherits from their role(s) you have to use add_cap with a grant value of false. Basically the function names would be better called add_override and remove_override.
If you find that still isn’t producing the result you want, it may be that you need to be using get_user_to_edit($id) to generate your user object.
This works in 3.1.4, I haven’t tried out 3.2 yet.
Forum: Fixing WordPress
In reply to: register_post_type() what does the rewrite['pages'] argument do???I wondered about this too, and looking at the WP code it looks like it is for pagination on index/archive pages.
So if you register the custom post type using
has_archive = > truethen the rewrite argument'pages' => falsemeans that pagination will not be applied to the index page for that post type e.g. domain/whatever/