Insert HTML in post, below nav bar but above content?

Edit your single.php or single-post.php template, depending on which one is present and in use with your theme. The JS file should be registered and conditionally enqueued when the template is loaded. This allows for dependency management and lots of other easy management actions. Another way to consider is make your menu an actual WordPress … Read more

Hook to init or call explicitly within functions.php

If we take your code at face value, there are some consequences: it runs on every request, be that a page, an AJAX call, a REST API request, even XMLRPC It’s a super expensive post query that involves post meta, with no upper limit on the number of results You are filtering a post query … Read more

I don’t understand how add_action and do_action work in tandem. The former executes the code already…what is do_action for?

The do_action() function executes any code that’s been hooked with add_action(). The only reason your function_save_custom_form_data() function runs is because the WP Forms plugin has added a call to do_action() inside its code. So what using do_action() in a theme or plugin does is allow other plugins or themes to run code during its processes. … Read more

How to get user meta fields that have just been updated?

For anyone else with this issue, the fix was simple. I changed the hook and most importantly, I changed the priority so my action comes later. Default wordpress priority was 10, so I set priority to 11 and it works. add_action( ‘profile_update’, ‘BB_WP_SYNC_update_BB_profile’, 11, 2); And my function changed due to the different hook: function … Read more

Giving the_excerpt in the place of the_content?

All good examples. But they weren’t working for me with the theme (pinboard) and plugin I was using (secondary-html-content) and what I wanted to do. The first challenge was to make sure that I get both pieces of content instead of just one. The second challenge was to replace the excerpt on the homepage with … Read more

add_action second argument missing

You have to say how many parameters your callback function needs. The default is 1, so WordPress will pass just $a. To get more parameters, use the fourth argument for add_action(): add_action(‘test’, ‘testing’, 10, 2 );

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