WordPress SEO – Twitter – Hashtag Support
-
Support –
Can you let me know how to add Category Hashtags prefixed to Jetpack Publicize tweets? Certainly, the awesome team at Automattic can make that happen.
I have Twitter Cards working through WordPress SEO but want to add a Category Hashtag prefix as a template to outgoing Jetpack Publicize tweets.
Thanks for an outstanding plugin!
jcarrier
-
Once you add this code to a custom plugin or add it to your theme’s functions.php file, you don’t need to do anything else; the first category added to your post will be added to the beginning of each publicized message.
This will only work with newly published posts, though; the posts you’ve published in the past won’t be updated.
Jeremy –
I’m not sure you revcieved this so I wanted to post it again in the forum. Here is what I have figured out about making the category hashtags prefix to publicized posts.
– I have disabled all plugins except for Jetpack, Jetpack Category Hashtags, and Buzz Burner to easily troubleshoot why category does not prefix to published posts.
– If I press the publish post button within edit posts for a post that I write using the WordPress editor, then the post publishes with the prefix category included.
– If I run a campaign from Buzz Burner plugin that pulls in feeds and publishes when you press “Run Campaign”, it does not prefix category to published posts.
Can you please let me know how I can easily modify the code snippet below so that it adds the category prefix when a Buzz Burner campaign is run?
I have your temp admin still enabled to take a look at the issue when you have a minute. I am very close now. Thanks again.
jcarrier
P.S. Interestingly, if the WP Bitly plugin is activated, the publicize custom message box does not include it but it IS included in the Twitter publicized post!
=========================
// Create our custom Publicize message
function jeherve_cust_pub_message() {
$post = get_post();// Grab the first category of your post
if ( !empty( $post ) )
$categories = get_the_category( $post->ID );if ( !empty( $categories ) ) {
$previous_cust = get_post_meta( $post->ID, ‘_wpas_mess’, true );$custom_message = ‘#’ . $categories[0]->cat_name . ‘ /’ . ‘ ‘ . $previous_cust;
update_post_meta( $post->ID, ‘_wpas_mess’, $custom_message );
}
}// Save that message
function jeherve_cust_pub_message_save() {
add_action( ‘save_post’, ‘jeherve_cust_pub_message’, 21 );
}
add_action( ‘publish_post’, ‘jeherve_cust_pub_message_save’ );Hi! What new concerning hashtags in Twitter?
Category or tag options as hashtags.
Through a code it is impossible to make independently.
Thanks@karlson2007 You can use the same method and the same hooks I detailed above to get categories and / or tags to be displayed in the Publicize message.
Site:
https://photopixel.tk/function.php coding:
https://joxi.ru/L_tQU_3JTJAAaHqJ8t0Custom Post Creation:
https://joxi.ru/3vpQU_3JTJD_Z70K04oPostResult:
https://joxi.ru/6ftQU_3JTJAPaFOVn6k
https://photopixel.tk/custom-post-title-1-2/Twitter Result:
2 times show category, and is lost title a post
https://twitter.com/photopixelfeed/status/457100470285131776
https://joxi.ru/lfxQUxjKTJBwDg7PgoI//———————————————————
for Tags i change
$categories = get_the_category( $post->ID );
to
$categories = get_the_tags( $post->ID );Function :
https://joxi.ru/mv1QU_3JTJBdbAgN1ZUPost Creation:
https://joxi.ru/3_1QUxjKTJB6DhYyqi0Result:
https://twitter.com/photopixelfeed/status/457103083634315265
https://joxi.ru/Sf5QU_3JTJBhaEFv1Yctitle is in place , but no tags…
At me it turns out nothing.
I received such results.
Code:
https://joxi.ru/NgtRUxjKTJBuDuNUqKs
https://joxi.ru/UQxRUxjKTJBxfi4W_DEResult:
https://joxi.ru/UwtRU_3JTJD9Z9kv5no
https://joxi.ru/ZgxRU_3JTJD-Y-Q5J2kI think tags doesn’t show because it is necessary to use a loop.
It is necessary to me that tags were after URL.Read this article https://vip.wordpress.com/documentation/customizing-publicize-sharing-behavior/
But can’t find this in files:
https://joxi.ru/swxRU_3JTJDlZ43u5qYYou’ll need to make more changes to add tags after the post title. In the example above, we added the categories before the post title, and not after. Since you want to add tags, you can’t use things like
$categories[0]->cat_name
.Could you give it another try, while reviewing the code and changing all references to tags?
No, I any more didn’t try.
Now I use the paid alternative https://dlvr.it/ service.
But I want to use all opportunities of one plug-in of jetpack.In Twitter the basis of everything is hashtags.
It is necessary to make this option professionally.Hi, just considering switching my Jetpack plugin for another post to twit plugin. I also need the option to use me wp-tags as hashtags. Is there a solution for this here. I can see, that i am not the only person how needs this.
Hope someone here can deliver ??
As I am interested in customizing the outputs for hashtags as well, I read what you had posted up about customizing publicize output.
This was my go at it…
function apply_custom_twitter_message(){ $post = get_post(); $url = $url = get_permalink($post_id->ID); $message = $post -> post_title.' @NoVoiceless @'.get_the_author_meta ('user_twitter' , $post-> post_author ); $posttags = get_the_tags($post->ID); $tags = null; if ($posttags) { foreach($posttags as $tag) { $tags = $tags.' #'.$tag->name; } } echo apply_filters( 'publicize_twitter_message', $message , $tags, $url ); } apply_custom_twitter_message();
It just made my pc sit and try to submit… loop maybe? I dunno.
Anyone want to critique this and tell me what I did wrong?
One thing that I am no good with yet in WP is hooks and filters. I just can’t seem to find anything good to read on how to use them.
any thoughts?
@awwnuts I would suggest starting from the code I posted above:
https://www.ads-software.com/support/topic/jetpack-publicize?replies=27#post-4836869Right now your code won’t do much since it isn’t hooked to anything.
Here is a temporary solution for this issue, i hope that Automattic guys add this functionality to the plugin, but meanwhile we are working on a better solution. https://outbc.co/1oSyIdu
@julius Doom I would strongly recommend against your solution, as it requires editing core WordPress files. If you’d like to bulk-customize Publicize messages, I would suggest using the code I mentioned in my message above.
I tried adding the code but am not tech savy enough to make it work.
There is a plugin available that offers this functionality for free that I have installed and tested:
https://www.ads-software.com/plugins/social-networks-auto-poster-facebook-twitter-g/
As soon as something like this appears in Jetpack though, I’ll be reverting back!
- The topic ‘WordPress SEO – Twitter – Hashtag Support’ is closed to new replies.