More Than One OG URL Specified and only Yoast graph is open not Jetpack - wordpress

I'm having some problem with the od: tags which is the most common issue.
Only Yoast is active for open graphs not Jackpack publicize and then how the og: tags are showing in the header of the page as shown above in the image.
would be grateful if anyone can help

There can be two possibilities:
The other og tag is printed in theme's header.php. If it's there then comment that code and you're good to go.
The OG tag is being generated by some function hooked to wp_head hook. Now it can be anywhere, in any file in plugin or theme. The best approach would be to check all the hooked functions for wp_head hook. You can do so by this code:
add_action("wp", function(){ print_r($GLOBALS['wp_filter']); echo '';exit; } );
Write this code in functions.php of your theme and look for all the functions which are hooked with wp_head hook. You can then comment the code in that particular function.

It is possible that your template adds the additional og:url header (from your page source it appears so). You need to disable the additional headers using either a switch in template settings or by manual edit.

Related

How can I call a shortcode in a shortcode?

I wanted to call the following shortcode in the wordpress page editor:
[pdfjs-viewer url=/wp-content/uploads/pdfs/[wpcf7_session_id]/vertrag.pdf viewer_width=100% viewer_height=1500px fullscreen=true fullscreen_text='Im Vollbildmodus anschauen' download=true print=true]
problem is the shortcode [wpcf7_session_id].
Any chance to call that somehow in the page editor?
Or do I need to call it in the backend in the php files? How can I do that?
Shortcodes do not automatically nest -- you have to call do_shortcode($content) yourself. See the caption_shortcode() example on http://codex.wordpress.org/Shortcode_API.

Elementor - adding custom code right after the <head> tag

Not sure if this is only problem for Elementor full width template, but it seems to override theme header.php. I tried achieving my goal by using elementor custom code feature, but it adds my code somewhere in middle of the tag.
What is the propper way of adding my own custom code as the first thing that is after the element?
You are right Elementor overrides the theme's header.php file so importing your code to this file is not effective. You need to add custom function to earn your goal. With the wp-head action you could add the code right into your header and Elementor will not override it.
Add this code to the functions.php file od your active theme.
add_action('wp_head', 'custom_head_function');
function custom_head_function(){
?>
YOUR HEADER CODE HERE
<?php
};
UPDATE - If you want to set your code at the top
As sephsekla mentioned in comment, there is a way to set the priority into your action to get it to the top. Try to set value to -999. So, choose a very low number and if there is no other lower number in your plugin or theme you will go straight to the top.
add_action('wp_head', 'custom_head_function', -999);
function custom_head_function(){
?>
YOUR HEADER CODE HERE
<?php
};
Elementor now supports custom code (javascript, html, etc) and supports the specific use of elements in the head of the page.
What you are looking for you can find at the Wordpress Dashboard> Elementor > Custom Code . Then you will be able to add a custom code to the head: https://elementor.com/help/custom-code-pro/

Add comments to wordpress inspect element page

As the title says, I want to add some sort of signature with comments on my wordpress index file, thing is - there are 30 different index files and none of them seems to work
If I understand correctly, it'll just be a case of adding some HTML comments (not PHP comments as they won't show in the source code) in your theme files. Bear in mind that editing a theme won't work if someone else made it and releases updates to it as it'll overwrite your changes if you update it.
The best place to add in the comments is to either open the header.php file and place your HTML comments after the opening <body> tag. If your theme doesn't include a header file, you could always add your comments to the top of your themes index.php file instead.
Your theme should be located within /wp-content/themes/YOUR-THEME/.
Alternatively, you could also place HTML comments between the <head> tags of your theme so they show up a bit higher in the source code. To do this, it's probably best to use an action hook instead. Place this in your themes functions.php file:
add_action( 'wp_head', 'add_signature_to_theme', 1, 0 );
function add_signature_to_theme() {
?><!-- Welcome to my website. --><?php
}
The wp_head action hook documentation is useful to have as reference as well if you'd like a bit more information on what it is and what it does.

Where can WordPress (self-installed) shortcodes be rendered?

I've looked around for this but can't seem to find a definite answer. I want to know where WordPress shortcodes are supported within the (self-hosted) platform - meaning where can I safely place shortcode content and expect it to be rendered? I know I can use them in post and page content, and some widgets that output something. But can I use them in other plugins (that also output something), and which widgets are supported? Do custom plugins need to have something enabled that allows them to render shortcode content?
This page says:
By default, WordPress does not support shortcodes within Sidebar Widgets. It only expands the shortcodes within the content of a Post, Page, or custom post type.
... although I've gotten shortcodes to work in the arbitrary text widget, so that information doesn't seem accurate. It also suggests I install this plugin that hasn't been updated in years.
Is there any clarification somewhere on this that I've missed?
You can use:
<?php do_shortcode('name_of_shortcode'); ?>
e.g echo do_shortcode('[gallery autoplay=no]');
and it will render this shortcode. You can place it in functions.php, header.php, footer.php.
EDIT:
If you want it to work in Text Widget, all you need is to add this line of code in functions.php file:
add_filter('widget_text', 'do_shortcode');

insert in the head tag after wp_head

Using wordpress 2.9.2. I am loading my css files for plugins as they are being called, which ofcourse is after my header has been loaded. I want to insert the calls those css files in the HEAD tag of the page, which can be done if i get a hook which includes lines in the head after wp_head() has been called. Help !
Look at http://codex.wordpress.org/Plugin_API/Action_Reference/wp_head - the action is called wp_head.
You will want to use wp_register_style() to register your CSS file followed by wp_enqueue_style() to actually add it to the list of stylesheets that are output.
There is an example on that page, but replace 'wp_print_styles' in the example with 'wp_head'.
Have you tried echoing the styles or .css include the in a function passed into wp_print_styles API action hook?
If you are using your own theme, you can just put <style> tags in your header.php file pointing to the stylesheets you are using.
If you need a hook, it is called wp_head (check the Codex documentation on it).
The solution that worked for me was inserting the css files in head using output buffer.

Resources