Plugin Directory

Changeset 2555377


Ignore:
Timestamp:
06/28/2021 04:30:49 PM (5 years ago)
Author:
shawon.info
Message:

1.0.7

Location:
socialmark
Files:
213 added
4 edited

Legend:

Unmodified
Added
Removed
  • socialmark/trunk/changelog.txt

    r2554807 r2555377  
    1212= 1.0.5 =
    1313 * Paid version yoast and rankmath conflict with custom post type solved.
     14= 1.0.6 =
     15 * Paid version custom post type sidebar added
     16= 1.0.7 =
     17 * SocialMark and Yoast SEO Bug Fixed
  • socialmark/trunk/includes/frontend.php

    r2551111 r2555377  
    44define( 'SOCIALMARK_UPLOAD_BASE', $socialmark_upload_dir['basedir'] );
    55$socialmark_og_row = $wpdb->get_results("SELECT id FROM {$wpdb->prefix}sm_images", ARRAY_A);
     6
    67if (in_array('wordpress-seo/wp-seo.php', apply_filters('active_plugins', get_option('active_plugins'))) || in_array('wordpress-seo-premium/wp-seo-premium.php', apply_filters('active_plugins', get_option('active_plugins')))) {
    7 
    8     add_filter('wpseo_opengraph_image', 'socialmark_change_wpseo_og_img_url');
    9     function socialmark_change_wpseo_og_img_url($url)
     8    function socialmark_yoast_support(){
     9        if (!is_front_page() && !is_home()) {
     10            function socialmark_change_wpseo_og_img_url($url)
     11            {
     12                $post_id = get_the_ID();
     13                if (is_singular('post') || is_singular('page')) {
     14                    if (get_post_type($post_id) === "post" && get_option('disable_socialmark') !== "on" && get_option('disable_socialmark_posts') !== "on") {
     15                        $post_id = get_the_ID();
     16                        //return str_replace(wp_get_attachment_url(get_post_thumbnail_id($post_id)), socialmark_generate_og_image($post_id), $url);
     17                        return socialmark_generate_og_image($post_id);
     18                    }elseif (get_post_type($post_id) === "page" && get_option('disable_socialmark') !== "on" && get_option('disable_socialmark_pages') !== "on") {
     19                        $post_id = get_the_ID();
     20                        //return str_replace(wp_get_attachment_url(get_post_thumbnail_id($post_id)), socialmark_generate_og_image($post_id), $url);
     21                        return socialmark_generate_og_image($post_id);
     22                    }else{
     23                        return get_the_post_thumbnail_url($post_id,'full');
     24                    }
     25                }else{
     26                    return get_the_post_thumbnail_url($post_id,'full');
     27                }
     28            }
     29
     30            add_filter('wpseo_opengraph_image', 'socialmark_change_wpseo_og_img_url');
     31        }
     32
     33    }
     34    add_action('wp_head', 'socialmark_yoast_support', 1);
     35} else if (in_array('seo-by-rank-math/rank-math.php', apply_filters('active_plugins', get_option('active_plugins')))) {
     36    function socialmark_rankmath_support()
    1037    {
    11         if(!is_front_page() && !is_home()) {
    12             if (is_singular('post') || is_singular('page') || is_singular('product')) {
     38        if (!is_front_page() && !is_home()) {
     39            function socialmark_change_rankmath_og_img_url($attachment_url)
     40            {
    1341                $post_id = get_the_ID();
    14 
    15                 if (get_post_type($post_id) === "post" && get_option('disable_socialmark') !== "on" && get_option('disable_socialmark_posts') !== "on" && get_post_meta($post_id, 'socialmark_post_disable', true) !== "on") {
    16                     $post_id = get_the_ID();
    17                     //return str_replace(wp_get_attachment_url(get_post_thumbnail_id($post_id)), socialmark_generate_og_image($post_id), $url);
    18                     return socialmark_generate_og_image($post_id);
    19                 }elseif (get_post_type($post_id) === "page" && get_option('disable_socialmark') !== "on" && get_option('disable_socialmark_pages') !== "on" && get_post_meta($post_id, 'socialmark_post_disable', true) !== "on") {
    20                     $post_id = get_the_ID();
    21                     //return str_replace(wp_get_attachment_url(get_post_thumbnail_id($post_id)), socialmark_generate_og_image($post_id), $url);
    22                     return socialmark_generate_og_image($post_id);
     42                if (is_singular('post') || is_singular('page')) {
     43                    if (get_post_type($post_id) === "post" && get_option('disable_socialmark') !== "on" && get_option('disable_socialmark_posts') !== "on") {
     44                        return $attachment_url = socialmark_generate_og_image($post_id);
     45                    }elseif (get_post_type($post_id) === "page" && get_option('disable_socialmark') !== "on" && get_option('disable_socialmark_pages') !== "on") {
     46                        return $attachment_url = socialmark_generate_og_image($post_id);
     47                    }else{
     48                        return get_the_post_thumbnail_url($post_id,'full');
     49                    }
     50                }else{
     51                    return get_the_post_thumbnail_url($post_id,'full');
    2352                }
    24             }
    25         }
    26     }
    27 } else if (in_array('seo-by-rank-math/rank-math.php', apply_filters('active_plugins', get_option('active_plugins')))) {
    28 
    29     function socialmark_change_rankmath_og_img_url($attachment_url)
    30     {
    31         if(!is_front_page() && !is_home()) {
    32             if (is_singular('post') || is_singular('page') || is_singular('product')) {
    33                 $post_id = get_the_ID();
    34                 if (get_post_type($post_id) === "post" && get_option('disable_socialmark') !== "on" && get_option('disable_socialmark_posts') !== "on" && get_post_meta($post_id, 'socialmark_post_disable', true) !== "on") {
    35                     return $attachment_url = socialmark_generate_og_image($post_id);
    36                 }elseif (get_post_type($post_id) === "page" && get_option('disable_socialmark') !== "on" && get_option('disable_socialmark_pages') !== "on" && get_post_meta($post_id, 'socialmark_post_disable', true) !== "on") {
    37                     return $attachment_url = socialmark_generate_og_image($post_id);
    38                 }
    39             }
    40         }
    41     }
    42     add_filter("rank_math/opengraph/facebook/image", 'socialmark_change_rankmath_og_img_url');
    43     add_filter("rank_math/opengraph/twitter/image", 'socialmark_change_rankmath_og_img_url');
    44 
     53
     54            }
     55            add_filter("rank_math/opengraph/facebook/image", 'socialmark_change_rankmath_og_img_url');
     56            add_filter("rank_math/opengraph/twitter/image", 'socialmark_change_rankmath_og_img_url');
     57        }
     58    }
     59    add_action('wp_head', 'socialmark_rankmath_support', 1);
    4560} else {
    4661    if (!empty($socialmark_og_row)) {
     
    5065function socialmark_frontend_header()
    5166{
     67    if(!is_front_page() && !is_home()) {
    5268    if ( is_singular( 'post' ) ) {
    5369        $post_id = get_the_ID();
     
    7086        $post_id = get_the_ID();
    7187        if (get_post_type($post_id) === "page" && get_option('disable_socialmark') !== "on" && get_option('disable_socialmark_pages') !== "on") {
    72             $socialmark_generated_image=socialmark_generate_og_image($post_id);
     88            $socialmark_generated_image = socialmark_generate_og_image($post_id);
    7389            echo '
    7490            <!-- Social Image Generated by: SocialMark Plugin -->
    7591            <meta property="og:type" content="article" />
    76             <meta name="title" property="og:title" content="'.esc_html( get_the_title() ).'" />
    77             <meta property="og:url" content="'.get_permalink().'" />
     92            <meta name="title" property="og:title" content="' . esc_html(get_the_title()) . '" />
     93            <meta property="og:url" content="' . get_permalink() . '" />
    7894            <meta name="image" property="og:image" content="' . $socialmark_generated_image . '">
    7995            <meta name="twitter:card" content="summary_large_image">
    80             <meta name="twitter:title" content="'.esc_html( get_the_title() ).'" />
     96            <meta name="twitter:title" content="' . esc_html(get_the_title()) . '" />
    8197            <meta name="twitter:image" content="' . $socialmark_generated_image . '">
    8298            <!-- End: SocialMark Plugin -->
    8399            ';
    84100        }
    85 
     101    }
    86102    }
    87103}
     
    89105function socialmark_generate_og_image($post_id)
    90106{
     107
    91108    if (get_post_meta($post_id, 'socialmark_og_image_url', true) && get_post_meta($post_id, 'socialmark_og_image_url', true) !== "") {
    92 
    93109        $socialmark_og_image = SOCIALMARK_UPLOAD . '/' . esc_attr(get_post_meta($post_id, 'socialmark_og_image_url', true));
    94110        $socialmark_og_image_url = SOCIALMARK_UPLOAD_URL . '/' . esc_attr(get_post_meta($post_id, 'socialmark_og_image_url', true));
     
    108124{
    109125    global $wpdb;
    110     if (get_post_meta($post_id, 'socialmark_post_overlay', true) === "default" || get_post_meta($post_id, 'socialmark_post_overlay', true) === "" || get_post_meta($post_id, 'socialmark_post_overlay', true) === false) {
    111126        if (get_option('default_socialmark_overlay')) {
    112127            $socialmark_de_ov = esc_attr(get_option('default_socialmark_overlay'));
     
    119134                }
    120135        }
    121     }
    122136        $socialmark_overlay_position = get_option('default_socialmark_position');
    123137    if (isset($socialmark_overlay_image) && isset($socialmark_main_image) && isset($socialmark_overlay_position)) {
  • socialmark/trunk/readme.txt

    r2554807 r2555377  
    55Tested up to: 5.7.1
    66Requires PHP: 5.3.0 or higher
    7 Stable tag: 1.0.5
     7Stable tag: 1.0.7
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
     
    126126= 1.0.5 =
    127127 * Paid version yoast and rankmath conflict with custom post type solved.
     128= 1.0.6 =
     129 * Paid version custom post type sidebar added
     130= 1.0.7 =
     131 * SocialMark and Yoast SEO Bug Fixed
  • socialmark/trunk/socialmark.php

    r2554807 r2555377  
    55 * Plugin URI:        https://shawonpro.com/socialmark-wp-plugin/
    66 * Description:       Easy way to add/change overlay/watermark to Facebook, Twitter, open graph post preview images.
    7  * Version:           1.0.5
     7 * Version:           1.0.7
    88 * Author:            ShawonPro
    99 * Author URI:        https://shawonpro.com/
Note: See TracChangeset for help on using the changeset viewer.