Skip to content

Instantly share code, notes, and snippets.

@dz0ny
Created July 25, 2012 11:34
Show Gist options
  • Save dz0ny/3175657 to your computer and use it in GitHub Desktop.
Save dz0ny/3175657 to your computer and use it in GitHub Desktop.
<?php
/*
Plugin Name: Urejevalnik
Description: Tabela, znaki itd
Author: Janez Troha
Version: 1.0
Author URI: http://www.dz0ny.info
*/
function fb_change_mce_buttons( $initArray ) {
$initArray['theme_advanced_blockformats'] = 'p,pre,code,h2,h3,h4,h5,h6';
$initArray['theme_advanced_disable'] = 'forecolor';
$initArray['theme_advanced_buttons1'] = 'bold,italic,strikethrough,|,bullist,numlist,blockquote,|,justifyleft,justifycenter,justifyright,|,link,unlink,wp_more,|,fullscreen,wp_adv';
$initArray['theme_advanced_buttons2'] = 'formatselect,underline,justifyfull,forecolor,|,pastetext,pasteword,removeformat,|,charmap,|,outdent,indent,|,undo,redo,wp_help';
$initArray['theme_advanced_buttons3'] = 'tablecontrols';
$initArray['plugins'] = 'safari,inlinepopups,table,paste,wordpress,media,fullscreen,wpeditimage,wpgallery,tabfocus';
return $initArray;
}
add_filter('tiny_mce_before_init', 'fb_change_mce_buttons');
add_filter('pre_get_shortlink', 'povezava_z_GA_integracijo', 10, 4);
function povezava_z_GA_integracijo($false, $post_id, $context, $allow_slugs) {
if($post_id==0) {
global $wp_query;
if ( 'query' == $context && is_single() ) {
$post_id = $wp_query->get_queried_object_id();
} elseif ( 'post' == $context ) {
$post = get_post($id);
$post_id = $post->ID;
}
}
if($post_id==0) return false;
$short_link = ""; //get_post_meta($post_id, 'shortlink', true);
if('' == $short_link) {
$short_link = home_url('?p='.$post_id."&utm_campaign=socmediji&utm_medium=povezava&utm_source=!! VNESI twitter ALI facebook !!");
if('' == $short_link) return false;
update_post_meta($post_id, 'shortlink', $short_link);
}
return $short_link;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment