Mark Jansen
Forum Replies Created
-
Forum: Plugins
In reply to: [WP Set Featured Image From Content] Not workingThat is weird.
Is there any way, that I can take a look at the install?
Forum: Plugins
In reply to: [WP Set Featured Image From Content] Not workingIs
WP_DEBUGon? Do you get any errors in your errorlog?Forum: Plugins
In reply to: [WP Set Featured Image From Content] Not workingWhat version of WP are you running and also what version of PHP?
The plugin requires at least PHP 5.3
Forum: Plugins
In reply to: [WP Set Featured Image From Content] Not workingHello Venutius,
thanks for downloading the plugin. How did you use it? After you’ve installed it, you have to go to extra -> WP Set Featured Image From Content and use the button there.
Does that solve your problem?
- This reply was modified 9 years, 11 months ago by Mark Jansen.
Forum: Fixing WordPress
In reply to: New update available but nothing there?I have the same problem.
Forum: Plugins
In reply to: remove_action from other plugin fileResolved. Apparently the prio number had to be the same as used in adding the action.
Forum: Hacks
In reply to: Changing sample permalinkBig big big thank you Danny.
Turns out I didn’t read the tutorial all that well and I had to create the structure in the init hook and the permalink itself in the post_type_link hook.
It works now with the following code:
add_action( 'init', array( $this, 'match_permalink_structure' ) ); add_filter( 'post_type_link', array( $this, 'better_match_permalinks' ), 10, 3 );public function match_permalink_structure() { global $wp_rewrite; $structure = __( 'match', 'apollo' ) . '/'; $structure .= '%year%/%month%/%day%/'; $structure .= '%matches%/'; $wp_rewrite->add_rewrite_tag( "%matches%", '([^/]+)', "matches=" ); $wp_rewrite->add_permastruct( 'matches', $structure, false ); } public function better_match_permalinks( $permalink, $post, $leavename ) { $rewritecode = array( '%year%', '%month%', '%day%', $leavename ? '' : '%matches%', ); $timestamp = get_field( 'match_datetime', $post->ID ); if( ! empty( $timestamp ) ) { $year = date( 'Y', $timestamp ); $month = date( 'm', $timestamp ); $day = date( 'd', $timestamp ); } else { $year = date( 'Y', strtotime( $post->post_date ) ); $month = date( 'm', strtotime( $post->post_date ) ); $day = date( 'd', strtotime( $post->post_date ) ); } $rewrite_replace = array( $year, $month, $day, $post->post_name, ); $permalink = str_replace($rewritecode, $rewrite_replace, $permalink); # Flush rewrite rules, so the changes are visible. //flush_rewrite_rules(); return $permalink; }Thanks!
Forum: Hacks
In reply to: Changing sample permalinkThanks for your answer.
1. Hm, strange, because the permalink seems to work fine. When ever I save the post, the sample-permalink shows up correctly and the permalink works. When I pull up the permalink in the frontend, it gives me the permalink I expect.
I based my code on this tutorial:
http://shibashake.com/wordpress-theme/custom-post-type-permalinks-part-22. I thought the post_type_link filter was designed for this, that is why I used it. I’ll have a look at the documentation you posted.
3. I am using ACF yes, but when it is autosaved, and I forgot to mention this is only when it’s a new post, it should use the
$post->post_datebecause$timestampwill be empty. When I dump the$postvariable to the screen, it shows up, but not on autosave, then it seems to be empty. Very strange.When I publish or draft the post, it works fine. It’ll either get the ACF date or the post date.
Forum: Hacks
In reply to: Changing sample permalinkThe hook is called in my custom plugin using the following line:
add_filter( 'post_type_link', array( $this, 'better_match_permalinks' ), 10, 2 );Your explanation about the filters makes sense, but shame that in this case you get the entire HTML, where you really wouldn’t want that π (well I don’t :P)
Forum: Hacks
In reply to: Changing sample permalinkOk, I found out perhaps the filter ‘get_sample_permalink_html’ could help me further, but I am a bit in the dark about some things.
1. Why do I not get the structure I am building when I hook into post_type_link. Why is the link that I see different and also for example, when I hover over a link in a connected post (using Posts2Posts for that), I get the ‘ugly’ URL, not my custom permalink structure
Perhaps if I understand that, I can fix this problem in a whole different way maybe. Maybe I am approaching this entirely wrong.
2. get_sample_permalink_html gives me the entire html from the permalink, get_sample_permalink is also a function, but that one has no filter. Perhaps that is something that I am overlooking or is that’s intended?
3. If I try to apply my custom permalink structure, see the code in my post above, it gives me 1970/01/01 as date. It looks like $post entirely disappears when autosave kicks in.
So all in all, I am not that much wiser, but I hope I’m getting somewhere. Anyone who can give me another kick in the right direction?
Forum: Plugins
In reply to: [Custom Post Template] Doesn't work with a Child ThemeI have the same issue. The fix 082net posted works, but is there a way to fix this in the theme? If I ever update this plugin, chances are I will lose this fix.
Forum: Plugins
In reply to: [The Events Calendar] Events Calendar Problem resulting in missing menu barI’m having the same problem.
Since the update to 2.0.11 which I did a few hours ago the menu generated by wp_nav_menu() is missing, it breaks the entire template. In fact, it only loads the header and then entirely breaks down at the menu.
I’ve read a few topics about it and I’ve found that a lot of the problems are being caused by the permalink structure. The structure I’m using is /%category%/%postname%/. But this should pose no problem right?
I’m a user of Events Calendar Pro btw, I’m not sure if that makes any difference.
Ok, still not entirely what I need. Now I get the field slug, but I also want the field label.
So I’m kinda back to square one. I now have a way to find the slug from the fields, but is there no easier way to find the label and the value of the custom fields in a group?
I came up using this:
<?php $group_fields = get_post_custom(4); $fields = explode(',', $group_fields['_wp_types_group_fields'][0]); foreach($fields as $field) { if(trim($field) != '') { $value = get_post_custom_values('wpcf-'.$field, get_the_ID()); echo $value[0]; } } ?>Anyone have a better solution? Otherwise I’m sticking with this.
Ok I’ve only gotten so far.
Somehow it seems I can find the field names, but not the values that go with them.
Sooo, anyone? π