maxworkingwell

social_image_share

Jul 15th, 2021 (edited)
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.08 KB | None | 0 0
  1. // Share image for articulo
  2. add_filter('wpseo_opengraph_image', 'social_image_articulo');
  3. function social_image_articulo($image) {
  4. global $post;
  5. if( is_singular( ['articulo'] ) ){
  6. $image = get_post_meta($post->ID, 'wpcf-imagen-full', true);
  7. }
  8. return $image;
  9. }
  10.  
  11. // Share image for columnista
  12. add_filter('wpseo_opengraph_image', 'social_image_columnista');
  13. function social_image_columnista($image) {
  14. global $post;
  15. if( is_singular( ['columnista'] ) ){
  16. $image = get_post_meta($post->ID, 'wpcf-foto-del-columnista', true);
  17. }
  18. return $image;
  19. }
  20.  
  21. // Share image for blogger
  22. add_filter('wpseo_opengraph_image', 'social_image_blogger');
  23. function social_image_blogger($image) {
  24. global $post;
  25. if( is_singular( ['blogger'] ) ){
  26. $image = get_post_meta($post->ID, 'wpcf-foto-del-blogger', true);
  27. }
  28. return $image;
  29. }
  30.  
  31. // Share image for debate
  32. add_filter('wpseo_opengraph_image', 'social_image_debate');
  33. function social_image_debate($image) {
  34. global $post;
  35. if( is_singular( ['debate'] ) ){
  36. $image = get_post_meta($post->ID, 'wpcf-foto-del-ponente-a-favor', true);
  37. }
  38. return $image;
  39. }
Add Comment
Please, Sign In to add comment