Add Post Meta Data by using Element?

Is there a way to add post metadata by using an element?

Hello Andrew,

Thanks for writing in!

X theme is having default meta tags and can be activated from X/Pro > Theme Options > Open Graph. Having said that if you are looking for more control then you can take a look at Yoast SEO plugin.

If you are using Yoast SEO then please remember to turn of Open Graph setting under X/Pro > Theme Options > Open Graph.

Thanks.

Thanks, maybe i should have been more clear…sorry.

I am hoping to add, post Title, post author etc. in a custom spot. I would like to do this in Cornerstone so I can create custom templates for my client.

Hello Andrew,

Thank you for the clarifications. What you have in mind can be achieve by utilizing the Dynamic Content feature in the latest release update of the theme. To know more about how you can use Dynamic Content for your template, please check out our changelog here:

Hope this helps. Please let us know how it goes.

This is AWESOME! and why you guys have the best template out there. I have one more request. In a previous post you gave me the ability to add Post Sharing data, I did this in the template:
<a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to: "%s"', '__x__' ), the_title_attribute( 'echo=0' ) ) ); ?>"><?php x_the_alternate_title(); ?>

Is there a way for me to add this through the dynamic content feature? Or to create a shortcode in the functions.php file?

Thanks!

Hi Andrew,

You mean that entire code? If yes then you’ll have to implement it as a shortcode. Example, please add this code to child theme’s functions.php


function x_post_link_custom () { ob_start(); ?>
<a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( <strong>( 'Permalink to: "%s"', 'x__' ), the_title_attribute( 'echo=0' ) ) ); ?>"><?php x_the_alternate_title(); ?>
<?php return ob_get_clean(); }

add_shortcode('x_post_link_custom', 'x_post_link_custom');

The code contains PHP code which already dynamic, you can then simply add [x_post_link_custom] to your contents.

Thanks!

Thanks so much! I made a mistake, I copied the wrong code, but I figured it out. I wanted the social sharing code in there. So this is what I added to functions.php

// Post Social [x_post_link_custom]
function x_post_link_custom () { ob_start(); ?>
<?php if(is_singular( 'post' )) echo do_shortcode('[x_share facebook="true" twitter="true" linkedin="true" email="true"]'); ?>
<?php return ob_get_clean(); }

add_shortcode('x_post_link_custom', 'x_post_link_custom');

It works perfectly!

Glad you’ve sorted it out.

Cheers!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.