Conditional string comparison failing for basename/slug

The 2nd part of the condition seems wrong basename( get_permalink() != ‘sponsor-one’) should be basename( get_permalink() ) != ‘sponsor-one’ Please check where the parenthesis ends. Also in your code if that is the only condition, then you can have an else statement instead of having another elseif.

Need help removing […] after excerpt

This has to work, Im using it in several projects: add_filter( ‘excerpt_more’, ‘my_excerpt_more’ ); function my_excerpt_more( $more ) { return ”; } Just copy-paste it to your functions.php. Little bonus snippet that you might need: add_filter( ‘excerpt_length’, ‘my_excerpt_length’ ); function my_excerpt_length( $length ) { return 50; } This means that excerpt is 50 words long. … Read more

child parent styles enqueue order

Looking at the id’s in your rendered code, the name of your parent style seems to be ‘basic-css’. That would mean you need array(‘basic-css’) as the dependency in your wp_enqueue_style. However, in the code the child style seems to be called ‘defaultbasic-css’, while you enqueue it as ‘child-style’. So it looks like there is some … Read more

Add valid XHTML closing img tags to WordPress galleries

As linked to from the comments on your question, the post_gallery filter should help you here. Unlike a lot of other hooks though, you can’t filter the output that comes through from WordPress; you can only provide your own alternative output. This is slightly annoying, and results in you needing to build the gallery from … Read more

Update if post with specific title exists

First, I would use WP_Query instead of the manual DB query (and don’t tell me that’s because of performance because you’re querying 2 times the same thing). Second, you’re saving your post as draft status and querying post with status publish