Mark Jansen
Forum Replies Created
-
Forum: Reviews
In reply to: [WP Set Featured Image From Content] Doesn’t workIf you could look in the logs that would be great.
What version of PHP are you running? The plugin requires 5.4+
Forum: Reviews
In reply to: [WP Set Featured Image From Content] Doesn’t workBe advised that if the images are external, this plugin does not (yet) support that. That is something that will be coming in soon, but I am not sure when exactly.
Forum: Reviews
In reply to: [WP Set Featured Image From Content] Doesn’t workHello Ganchan,
Thanks for your reply.
I know there is a small bug in the plugin that I yet have to fix which causes only the first 10 posts to be loaded.
See https://www.ads-software.com/support/topic/small-mistake-in-the-code/ for more information about that.
Are the images in your posts local or external images?
Forum: Reviews
In reply to: [WP Set Featured Image From Content] Doesn’t workHello Ganchan,
I’m sorry to hear that it might not work for you. Can you tell me how you used the plugin and / or do you maybe have an example?
Forum: Plugins
In reply to: [WP Set Featured Image From Content] Small mistake in the codeHello Mutusen,
Good catch, thanks for letting me know. I will fix this shortly of course.
And also thanks for the kind words. Much appreciated.
Forum: Plugins
In reply to: [WP Set Featured Image From Content] Not workingRight, I see where I went wrong. The menu item I mentioned ‘Extra’, should of course be ‘Tools’. My bad.
Forum: Plugins
In reply to: [WP Set Featured Image From Content] Not workingYou can PM me on slack, @yourmark, find me on twitter @mark_jansen or fill in the form on https://www.yourmark.nl/contact/
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_DEBUG
on? 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 8 years 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:
https://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_date
because$timestamp
will be empty. When I dump the$post
variable 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.