Skip to content

Instantly share code, notes, and snippets.

@deepak-rajpal
Created November 20, 2015 15:06
Show Gist options
  • Save deepak-rajpal/3795f9372d1ef3dc1ebd to your computer and use it in GitHub Desktop.
Save deepak-rajpal/3795f9372d1ef3dc1ebd to your computer and use it in GitHub Desktop.
WordPress Code snippets shortcodes
<?php
/* Disable auto paragraph - sometimes issue while content formatting with wordpress/ck-editor */
remove_filter ('the_content', 'wpautop');
// remove_filter ('the_content', 'wptexturize');
?>
<?php
/**
* Disable WordPress Canonical URL or Permalink Auto Redirect -
* When URL of post/page changes, old url automatically gets redirected to new or similar ones.
* Sometimes URL redirects to wrong pages but we need to highlight "Page Not Found" for every wrong URL.
*/
remove_action('template_redirect', 'redirect_canonical');
?>
<?php
/* Starts: Hide admin bar from front-end */
if(!is_admin()):
show_admin_bar(false);
endif;
/* Ends: Starts: Hide admin bar from front-end */
?>
<?php
/* Easy Shortcode to create home url - [site_url] */
add_shortcode('site_url','home_url');
?>
<?php
/* Including Evo Slider - Only if front end - So that no JS/CSS including if admin */
if (!is_admin()) { include TEMPLATEPATH . '/custom-files/evo_slider_wp.php'; }
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment