Skip to content

Instantly share code, notes, and snippets.

View tacoverdo's full-sized avatar

Taco Verdonschot tacoverdo

View GitHub Profile
@tacoverdo
tacoverdo / change_url_googles_ssb.php
Last active June 19, 2019 20:33
change_url_googles_ssb.php
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/**
* Changes the URL used for the Google Sitelink Search Box functionality in WordPress SEO (Premium)
* The returned string must always include {search_term} to indicate where the search term should be used.
*
* @returns string new searchURL
*/
function yoast_change_ssb_search() {
@tacoverdo
tacoverdo / disable_googles_ssb.php
Last active February 5, 2022 14:19
Disable Google's Sitelink Search Box in WordPress SEO (Premium)
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
// This disables the Google Sitelink Search Box functionality in WordPress SEO (Premium)
add_filter('disable_wpseo_json_ld_search', '__return_true');
<?php
// do not copy the line above
/**
* Removes the twittercard-information from Jetpack
* Thus allows WordPress SEO to handle the twittercards
*/
function yst_remove_twittercard_info() {
remove_filter( 'jetpack_open_graph_tags', 'wpcom_twitter_cards_tags' );
remove_filter( 'jetpack_open_graph_tags', 'change_twitter_site_param' );
ystThemeConfigL10n = { choose_image: "Use Image"};
// Taken and adapted from http://www.webmaster-source.com/2013/02/06/using-the-wordpress-3-5-media-uploader-in-your-plugin-or-theme/
jQuery(document).ready(function ($) {
var yst_custom_uploader;
var yst_target_id;
$('.yst_image_upload_button').click(function (e) {
yst_target_id = e.currentTarget.id.replace(/_button$/, '_input');
e.preventDefault();
if (yst_custom_uploader) {
@tacoverdo
tacoverdo / wp_rewrite_rules
Created November 25, 2013 23:14
WordPress basic rewrite rules
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
@tacoverdo
tacoverdo / Remove_prevnext_rel_links.php
Created October 22, 2013 15:11
Prevent addition of prev/next rel link by WordPress SEO
Movie on 'http://www.skyriderfilms.com/gay-video-series-coffee-talk-trailer-released/' returns:
stdClass Object
(
[version] => 1.0
[type] => video
[html] => <div id="wistia_4fpms58ph5" class="wistia_embed" style="width:960px;height:568px;"><div itemprop="video" itemscope itemtype="http://schema.org/VideoObject"><meta itemprop="name" content="Coffee Talk Trailer" /><meta itemprop="duration" content="PT30S" /><meta itemprop="thumbnailUrl" content="http://embed-0.wistia.com/deliveries/0ab49f12e1f1bc4000c9b784832500c6e1f1e809.bin" /><meta itemprop="contentURL" content="http://embed-0.wistia.com/deliveries/9666db8494fd669aa8e6016985768454549f20cc.bin" /><meta itemprop="embedURL" content="http://embed-0.wistia.com/flash/embed_player_v2.0.swf?2013-10-04&autoPlay=false&banner=true&controlsVisibleOnLoad=true&customColor=333333&endVideoBehavior=default&fullscreenDisabled=true&hdUrl%5Bext%5D=flv&hdUrl%5Bheight%5D=720&hdUrl%5Bsize%5D=9910795&hdUrl%5Btype%5D=hdflv&hdUrl%5Burl%5D=http%3A%2F%2Fembed-0.wistia.co
@tacoverdo
tacoverdo / howto_preanalysis_post_content.php
Created September 16, 2013 08:42
How to use wpseo_pre_analysis_post_content in WP SEO by Yoast?
<?php
/**
* Add (custom field) content to the post's content before WP SEO Analysis.
*
* @param string $content The content of a posts content-field.
*
* @return string The original content plus the value of the postmeta with meta_key '_yoast_postmeta_example'.
*/
function yst_custom_content_analysis( $content ) {
global $post;
@tacoverdo
tacoverdo / register_widget.php
Last active December 22, 2015 19:39
Simple way to add a widgetarea to a Genesis Childtheme
<?php
/**
* Register widget areas for Genesis Childthemes
* Includes i18n for name and description.
*/
genesis_register_sidebar( array(
'id' => 'Widgetarea_slug',
'name' => __( 'Title of your widgetarea', 'example' ),
'description' => __( 'Description that is shown in the admin of your WordPress website', 'example' ),
) );
@tacoverdo
tacoverdo / local SEO opening hours shortcode.php
Last active December 22, 2015 07:28
Local SEO by Yoast - Opening Hours shortcode
<?php
// Can be used in any (template) file, will do the same as [wpseo_opening_hours]
if ( function_exists( 'wpseo_local_show_opening_hours' ) ) {
$params = array(
'id' => 237,
'hide_closed' => false,
'echo' => true,
'comment' => ''
);
wpseo_local_show_opening_hours( $params );