Tagged: Google, hashtags, social links, twitter
-
AuthorPosts
-
October 13, 2014 at 5:33 pm #335055
Hello,
I need to know where in the php-code I can adapt the output of the Twitter-Sharing-Link at the bottom of the blog-post. I want to include predefined hashtags. The Twitter api allows this by including “&hashtags=value”.
Thanks
October 14, 2014 at 7:49 am #335404Hey shenom!
Thank you for using Enfold.
You can edit includes > helper-social-media.php. Find this code:
'twitter' => array("encode"=>true, "encode_urls"=>false, "pattern" => "https://twitter.com/share?text=[title]&url=[shortlink]")
Cheers!
IsmaelOctober 20, 2014 at 10:30 pm #338707Hello Ismael,
this is exactly what I did.
I changed includes > helper-social-media.php to this:
https://twitter.com/intent/tweet?text=[title]&url=[shortlink]&hashtags=CoachingBlogger
and saved the changed file to my child-theme in the folder ‘includes’.But it doesn’t work. I do not get a different Output as the one specified in the original php-file. Do I need to include the Twitter widget.js or is it already included in enfold?
I put this into my child-themes functions.phpif is_single() { echo '<script type="text/javascript async src="//platform.twitter.com/widgets.js"></script>'; }
I would also need to add a rel=”publisher” to the google+ Icon. Where would I add this?
- This reply was modified 10 years, 2 months ago by shenom.
October 20, 2014 at 10:57 pm #338723I changed the way I included the twitter-widgte to:
if (is_single()) { function load_twitter_widget() { wp_enqueue_script('twitter_widget', 'http://platform.twitter.com/widgets.js'); } add_action('wp_enqueue_scripts', 'load_twitter_widget'); }
But still no luck!! :(
October 21, 2014 at 8:33 am #338874Hey!
Thank you for the update.
I changed that line with your twitter format and it’s working fine. Please edit the file then remove browser cache before testing it.
Regards,
IsmaelOctober 21, 2014 at 12:33 pm #338972Hello Ismael,
the twitter format does work. I tested it, so there is nothing to change ([text] and [shortcode] are variables of the theme).
Screenshot1But the changed code doesn’t get accepted, because the browser still uses the old code:
Screenshot2I emptied all cache (Browser + from W3TC).
This is how the code looks like in includes > helper-social-media.php
Screenshot3- This reply was modified 10 years, 2 months ago by shenom.
October 22, 2014 at 10:50 pm #339786Hi,
Can you please create us an administrator account? post it here as a private reply.
Regards,
JosueOctober 23, 2014 at 12:46 pm #340041This reply has been marked as private.October 24, 2014 at 1:28 pm #340579So is anyone looking at the Problem with the Twitter-Links?
October 28, 2014 at 11:11 pm #342446Hi!
Your Twitter Links seem to work fine now. Could you fix it?
Regards,
AndyOctober 29, 2014 at 1:03 pm #342670Hello Andy,
what makes you think the twitter-Link is working. I do not mean the twitter-icon at the top of the screen (above the header)
I need the twitter-sharing button at the bottom of each single blog-post to show the hashtag I’ve added in
includes > helper-social-media.php (See the screenshots I provided above)It still doesn’t work on any blog-post. For example: http://goo.gl/jRwj3s
October 29, 2014 at 5:30 pm #342828Hey!
It should work now, you were missing this line in child theme functions.php:
require_once( 'includes/helper-social-media.php' );
Regards,
JosueOctober 30, 2014 at 12:38 pm #343363Thanks Josue,
now it works indeed.
Can you please explain, why the line above is needed in the child-themes function.php, while the helper-main-menu.php in the same folder is added/taken into account without any line (require_once) in the functions.php.
I added a custom search-icon in the mobile header through a change of includes > helper-main-menu.php. This worked right away and I didn’t “activated” the changed php-file in the child-theme in the functions.php.
October 30, 2014 at 6:18 pm #343518Hi!
Because /includes/helper-main-menu.php is included in header.php:64 using
get_template_part
.Child themes can override these templates the same as before — the child theme will just need to create the same directory structure to do it. (So, /page-templates/one-column.php needs to be overridden with /page-templates/one-column.php, not /one-column.php.) And yes, we’re only looking one level down.
http://nacin.com/2012/03/29/page-templates-in-subdirectories-new-in-wordpress-3-4/
Regards,
Josue -
AuthorPosts
- You must be logged in to reply to this topic.