I have installed Wordpress SEO by Yoast onto a site Im building. They have an area when you can add the description for the meta information.
However I want to add this to a twitter meta tag:
<meta name="twitter:description" content="">
Does anyone know how to grab the description and output it for a single page?
Cheers
You can use
<?php echo wpseo_get_value('metadesc'); ?>
wpseo_get_value('metadesc'); has been deprecated
Please use WPSEO_Meta::get_value("metadesc");
<?php echo WPSEO_Meta::get_value("metadesc"); ?>
If you need to add twitter:description meta data. Please follow below steps.
- Login to admin panel
- Go to menu item SEO->Social
- Uncheck the checkbox Add Open Graph meta data
- Go to tab Twitter
- Check the checkbox Add Twitter card meta data
- Click on save changes
Now if you visit the post page or any single page, you can see a meta tag with name twitter:description added to the head.
Hope this works for you
Related
how to use different description meta tag for each page in wordpress.
I have one header.php file for all of the theme.
To add different description Meta tags Without using plugin you could create Custom fields in Wordpress and then call them in your header.php file
https://wordpress.org/support/article/custom-fields/
Do check the SEO dashboard, Where you can change the description for each pages.
Go through the theme documentation, Every theme has a plugin to change the description.
Or use Google web master tool there are many resources and youtube tutorial which might help you.
I use Elementor page builder on my WordPress site. There is a problem with it - by default it doesn't allow editing WooCoomerce Shop/Products pages. The solution they say is to add to page templates code. I, being a beginner with no idea of coding, cannot figure out which file to add this code to and where in that file. I have been researching and trying to fix this myself for two weeks now, in vain. Please help me achieve this.
Here's what Elementor say: "Sorry, the content area was not found in your page. You must call the_content function in the current template, in order for Elementor to work on this page."
Go to Elementor setting and then check products in post types
Go to Products, click Edit on the product you want to edit, input something (ie. a full stop-sign '.') in the WP Editor, click Update. (See attached screenshot.)
Screenshot
There seems to be a misconception that Elementor can be used to "edit" any content.
For Elementor to work on a "Page" i.e. the post type that uses either the page.php or any theme declared page templates it requires the_content(); function to present in the code.
Issue #1: WooCommerce uses the woocommerce_content(); function to return the content of the shop.
Issue #2: The Shop output does not use the "Page" or Custom Page template - the output is equivalent to the index.php or home.php, neither of which are editable via Elementor.
Unless you are willing to write a pretty sophisticated function to collect all those elements' data and filter them into the_content(); function, there is currently no way of editing such content directly.
I know it's not the solution you are looking for but that is the current state of affairs. Having said that, some of us are working on all sorts of solutions and maybe, just maybe - we'll come up with a way to have this option available soon ;)
For shop page you should go to Elementor setting and then check products in post types.
Because shop page products are not the content but posts it's the solution.
So inlcude products in post types and edit with elmentor, if for some reason you can't see 'edit with elementor' under shop page, then just open shop page and add
/?elementor and it would enable elementor
NO need to add this code in any page follow these instruction.
You just need to clear cache and cookies your browser, Some time website take previous data to show the web page and give this error.
or
if you open your website private mode then login and go to the page by Elementor you will never face this problem.
At the moment I am using the more tag in wordpress to cut of my posts after about one paragraph on my home page, I am wanting to be able to have more control over what is displayed as the excerpt but selecting a start and an end point somehow. I am aware that this is not standard functionality of the more feature but is there a way to customise the more tage or is there an excerpt feature that can be implemented?
I'm not sure which version wordpress you are on, but you might be looking for the Excerpt functionality:
http://codex.wordpress.org/Excerpt
When you are editing a post if you don't see the "Excerpt," box, click the "Screen Options," box on the top of the screen. For 3.4.8 the screen options box is in the top right of the screen. You can click a checkbox that will display the excerpt box and write your excerpt in there. Then use:
<?php the_excerpt(); ?>
When you are theming. Here is a good tutorial:
http://www.wpbeginner.com/wp-themes/how-to-display-post-excerpts-in-wordpress-themes/
I want to include in my website the " Recently Viewed Produdcts" widget. I found out that i can do that with a shortcode as mentioned here: http://www.wpexplorer.com/woocommerce-recently-viewed-products-shortcode/
After implementing this code and creation of plugin the products appear in homepage very weird, very big and without any styling. Then i found out that there is already a widget in the widget section provided by woocomerce already.
I am very satisfied with the styling of it but i have some questions that i want to fix:
How do i add the widget to appear on all page just before the footer area?
How do i make that widget horizontal instead of vertical?
Thanks to whoever help me out !!!
You're going to have to insert the following into your footer.php file before the other div boxes start:
<div>
<?php
echo do_shortcode("[woocommerce_recently_viewed_products per_page='5']");
?>
</div>
Then we'll have to see what the styling looks like once that is in place.
First, install the plugin "Recently Viewed Products Shortcode"
then:
<div><?php echo do_shortcode("[woocommerce_recently_viewed_products per_page='5']"); ?></div>
'5' instead "5"
Just wonder if WordPress 3.5+ still attach gallery even if it is not added to the post content area.
Earlier WordPress was adding gallery as an attachment and allowing to populate via template tag even if it is not added to the content area. Now with version 3.5.1 I am trying to create a gallery and it is displaying if I add to the post content but as soon as I remove from the post content than gallery just disappear from the media library as well and there is no attachment found for the post.
Just wonder and trying to understand how they have changed the media library and gallery. I understand the basic that before they were creating a gallery id but now they are adding only image id so there is no more gallery id. Is that correct?
So question how can I add gallery using template tag something like <?php echo do_shortocode('[gallery link="file"]'); ?> or similar?
You have almost answered this question yourself!
Check the codex for the specifics.
I needed to do this with with a custom meta box and the details can be found here. Pre-Select Images when opening WordPress 3.5 media manager.
EDIT:
For the benefit of other readers and for clarification, something like this is required
echo do_shortcode( '[gallery ids="139,138,137,136"]' );
Where the ids is a comma seperated list of attachment id's you want included. This is it in the simplest form - check the codex for more options.