This file contains 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
<?php | |
/* | |
Plugin Name: WordPress Simple Google Analytics Plugin | |
Description: Lägger till Google Analytics-kod i <head> eller <footer> genom WordPress-hook | |
* Version: 1.0 | |
* Author: D. Andersson | |
* Author URI: https://dandersson.nu | |
*/ | |
defined( 'ABSPATH' ) or exit; |
This file contains 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
// kill genesis meta description when using another SEO plugin. also remove genesis SEO metas from posts. | |
remove_action( 'genesis_meta','genesis_seo_meta_description' ); | |
remove_action( 'admin_menu', 'genesis_add_inpost_seo_box' ); |
This file contains 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
<?php | |
add_action('wp_footer', 'add_googleanalytics'); | |
function add_googleanalytics() { ?> | |
// Paste your Google Analytics code here | |
<?php } | |
?> |
This file contains 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
//Add Google Analytics function | |
function google_analytics() { | |
include_once("analyticstracking.php"); | |
} | |
//Add tracking action, set Google Analytics | |
add_action('wp_head', 'google_analytics'); |
This file contains 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
//# Removing external scripts in Elementor #// | |
// For Google Fonts: | |
add_filter( 'elementor/frontend/print_google_fonts', '__return_false' ); | |
// For Font Awesome Icons: | |
// Also works on none Elementor-pages | |
add_action( 'wp_enqueue_scripts', function() { wp_dequeue_style( 'font-awesome' ); }, 50 ); | |
// To remove the Font Awesome http request as well: |
This file contains 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
User-agent: * | |
Disallow: /wp-admin/ | |
Disallow: /?s= | |
Disallow: /search/ | |
Allow: /admin/admin-ajax.php | |
Disallow: /cgi-bin/ | |
Disallow: /wp-content/cache/ | |
Disallow: /trackback/ | |
Disallow: */trackback/ |
This file contains 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 featuredtoRSS($content) { | |
global $post; | |
if ( has_post_thumbnail( $post->ID ) ){ | |
$content = '<div>' . get_the_post_thumbnail( $post->ID, 'medium', array( 'style' => 'margin-bottom: 15px;' ) ) . '</div>' . $content; | |
} | |
return $content; | |
} | |
add_filter('the_excerpt_rss', 'featuredtoRSS'); | |
add_filter('the_content_feed', 'featuredtoRSS'); |
This file contains 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
// 404 Full Width Page | |
add_action( 'get_header', 'custom_404_layout' ); | |
function custom_404_layout() { | |
if ( ! is_404() ) { | |
return; | |
} | |
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' ); | |
} |
This file contains 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
// Woocommerce SEO — Noindex 'Order by' archives | |
// Prevent indexing "Order by" | |
add_action( 'wp_head', 'woo_prevent_indexing_orderby' ); | |
if(!function_exists('woo_prevent_indexing_orderby')){ | |
function woo_prevent_indexing_orderby () { | |
if (isset($_GET['orderby'])){ | |
echo '<meta name="robots" content="noindex, nofollow">'; | |
} | |
} |
This file contains 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
//CUSTOM POST NAVIGATIONS | |
//* Customize the next page link | |
add_filter ( 'genesis_next_link_text' , 'sp_next_page_link' ); | |
function sp_next_page_link ( $text ) { | |
return '»'; | |
} | |
//* Customize the previous page link | |
add_filter ( 'genesis_prev_link_text' , 'sp_previous_page_link' ); | |
function sp_previous_page_link ( $text ) { | |
return '«'; |