Shortcode conflicts

When you define your shortcode, you might try one of a couple “if” statements to fix this issue, until you have time to create separate shortcodes. function cfgeo_shortcode( $atts, $content = “” ) { if (!isset($content) || stristr($content,’cfgeo’)!==FALSE){ // do short shortcode stuff here } else { // do ‘Container’ shortcode stuff here } return … Read more

How to use embed_content hook?

No, WordPress does not pass any arguments to the hook’s callbacks. And you can use that hook to display something after the embed excerpt is displayed. But this is of course, if the theme is using the default embed template for post embeds — with custom template, you could, if you want to, display the … Read more

Undefined variable error in new function

I believe that’s telling you that $post (in $post->ID) is undefined. Try this instead: function sh_reading_time() { $content = get_post_field( ‘post_content’, get_the_ID() ); $word_count = str_word_count( strip_tags( $content ) ); $readingtime = ceil($word_count / 200); if ($readingtime == 1) { $timer = ” minute”; } else { $timer = ” minutes”; } $totalreadingtime = $readingtime … Read more

does wp function the_content(); accept another tag inside

Why do you want to put your code between the braces in the_content()? What are you trying to accomplish? Maybe this solves your problem? <?php $custom_attach = get_post_meta( get_the_ID(), ‘wp_custom_attachment’, true ); $name=”button”; if(!empty($custom_attach)) { echo ‘<span class=”icon-download”>’; echo ‘<a href=”‘.$custom_attach[‘url’].'”>’.$name.'</a>’; echo ‘<span>’; } the_content(); ?> This echoes the <span> -element with the class icon-download … Read more

has_excerpt() not working inside wp_query

So we already resolved the issue via the comments, but I thought I should explain something: has_excerpt() returns ! empty( $post->post_excerpt ) if the post has a custom/manual excerpt, so if the function is returning true when it should be false, then it’s likely because the length of the excerpt in the database is > … Read more

Add function after the_content

The main issue in your code is caused by the call to zss_social_buttons() in your filter function: // In zss_insert_share_buttons(): $social_share_buttons = zss_social_buttons(); // NULL $content .= $social_share_buttons; And the problem there is that zss_social_buttons() is echoing the sharing links/buttons instead of returning them, so they’re not actually added to the $content variable. Instead, they’re … Read more

Filter content for get_the_content()

tl;dr. There’s probably a good way for you to do this in the specific case you describe, although WordPress does not allow for good, general filtering of the return value from get_the_content(). You cannot do this directly, but … There currently (as of WordPress 5.9.2, checked on 24 March 2022) isn’t a convenient, direct and … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)