This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function sp_gtag_link_tracking_ev($html) { | |
| return "window.addEventListener('load', function () { | |
| var links = document.querySelectorAll('a'); | |
| for (let i = 0; i < links.length; i++) { | |
| links[i].addEventListener('click', function(e) { | |
| var n = this.href.includes('".get_home_url()."'); | |
| if (n == false) { | |
| gtag('event', 'click', {'event_category': 'external links','event_label' : this.href}); | |
| } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function sp_gtag_anonymize_ip($html) { | |
| return "'anonymize_ip': true,"; | |
| } | |
| add_filter('seopress_gtag_anonymize_ip', 'sp_gtag_anonymize_ip'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function sp_gtag_link_attribution($html) { | |
| return "'link_attribution': true,"; | |
| } | |
| add_filter('seopress_gtag_link_attribution', 'sp_gtag_link_attribution'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function sp_gtag_allow_display_features($html) { | |
| return "'allow_display_features': false,'"; | |
| } | |
| add_filter('seopress_gtag_allow_display_features', 'sp_gtag_allow_display_features'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function sp_gtag_html($html) { | |
| return "your custom Google Analytics tracking code"; | |
| } | |
| add_filter('seopress_gtag_html', 'sp_gtag_html'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function sp_gtag_cd_hook_cf($html) { | |
| return "'dimension6': 'custom_dimension',"; | |
| } | |
| add_filter('seopress_gtag_cd_hook_cf', 'sp_gtag_cd_hook_cf'); | |
| function sp_gtag_cd_hook_ev($html) { | |
| return "gtag('event', '".__('My custom dimension','wp-seopress')."', {'custom_dimension': 'my_custom_data'});"; | |
| } | |
| add_filter('seopress_gtag_cd_hook_ev', 'sp_gtag_cd_hook_ev'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function sp_sitemaps_single_gnews_query($args) { | |
| //Default Query | |
| //$args = array( 'exclude' => '', 'posts_per_page' => 1000, 'order'=> 'DESC', 'orderby' => 'date', 'post_type' => $seopress_xml_sitemap_news_cpt_array, 'post_status' => 'publish', 'meta_query' => array( array( 'key' => '_seopress_robots_index', 'value' => 'yes', 'compare' => 'NOT EXISTS' ) ), 'date_query' => array(array('after' => '2 days ago')), 'post__not_in' => get_option( 'sticky_posts' ), 'lang' => ''); | |
| $args['posts_per_page'] = '100'; | |
| return $args; | |
| } | |
| add_filter('seopress_sitemaps_single_gnews_query', 'sp_sitemaps_single_gnews_query'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function sp_real_preview_remote($args) { | |
| //default: $args = array('blocking' => true,'redirection' => 2,'timeout' => 30,'cookies' => $args['cookies'],'sslverify' => false); | |
| $args['headers'] = array('Authorization' => 'Basic ' . base64_encode( 'admin' . ':' . 'password' )); | |
| return $args; | |
| } | |
| add_filter('seopress_real_preview_remote', 'sp_real_preview_remote'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function sp_sitemaps_html_pages_query($args2, $cpt_key) { | |
| //default: | |
| //$args2 = array('post_type' => $cpt_key, 'include'=>$postslist, 'sort_order' => $seopress_xml_sitemap_html_order_option, 'sort_column' => $seopress_xml_sitemap_html_orderby_option); | |
| $args2['exclude'] = 10; | |
| //exclude post with ID 10 | |
| return $args2; | |
| } | |
| add_filter( 'seopress_sitemaps_html_pages_query', 'sp_sitemaps_html_pages_query', 10, 2 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function sp_sitemaps_html_cat_query($args_cat_query) { | |
| //default | |
| //$args_cat_query = array('orderby'=>'name','order'=>'ASC','meta_query' => array( array( 'key' => '_seopress_robots_index', 'value' => 'yes', 'compare' => 'NOT EXISTS' ) ),'exclude'=>$seopress_xml_sitemap_html_exclude_option,'suppress_filters'=>false); | |
| $args_cat_query['exclude'] = '10,12,20'; //my ids | |
| return $args_cat_query; | |
| } | |
| add_filter( 'seopress_sitemaps_html_cat_query', 'sp_sitemaps_html_cat_query' ); |