Skip to content

Instantly share code, notes, and snippets.

View mkdizajn's full-sized avatar
🐢
slow & thorough > faster & mistakable

Kresimir Pendic mkdizajn

🐢
slow & thorough > faster & mistakable
View GitHub Profile
@mkdizajn
mkdizajn / wordpress child theme function override the parent theme with check.php
Last active December 16, 2015 10:48
wordpress child theme function override the parent theme with check
if ( ! function_exists( 'theme_special_nav' ) ) {
function theme_special_nav() {
// Do something.
}
}
@mkdizajn
mkdizajn / wordpress add page excerpts in admin.php
Last active December 16, 2015 13:19
wordpress add page excerpts in admin
<?php
add_action( 'init', 'my_add_excerpts_to_pages' );
function my_add_excerpts_to_pages() {
add_post_type_support( 'page', 'excerpt' );
}
?>
@mkdizajn
mkdizajn / wordpress tags similar to this post
Created May 15, 2013 12:41
wordpress get related tags
<?php
// Related Posts Function (call using bones_related_posts(); )
function bones_related_posts() {
echo '<ul id="bones-related-posts">';
global $post;
$tags = wp_get_post_tags($post->ID);
if($tags) {
foreach($tags as $tag) { $tag_arr .= $tag->slug . ','; }
$args = array(
@mkdizajn
mkdizajn / wordpress disable post format ui completely.php
Last active December 17, 2015 09:59
wordpress disable post format ui completely
<?php
// disable wordpress 3,6 post formats ui !
add_filter( 'enable_post_format_ui', '__return_false' );
?>
@mkdizajn
mkdizajn / wordpress function to get sinular <-> singular link between page and tax.php
Last active December 17, 2015 12:48
wordpress function to get sinular <-> singular link between page and tax
@mkdizajn
mkdizajn / gist:5612031
Created May 20, 2013 12:52
wordpress function to get page content by ID
<?php
// mk function to get page content by id!
// function() -> takes post ID
function mk_get_page_content_by_id( $pid ){
$page_id = $pid;
$page_data = get_page( $page_id );
$content = apply_filters('the_content', $page_data->post_content);
echo $content;
@mkdizajn
mkdizajn / gist:5612047
Created May 20, 2013 12:55
wordpress function to get all custom tax list items
<?php
// mk function to get all custom tax list items
// function() -> GET STRING
function mk_custom_tax( $taxstring ){
$terms = get_terms( $taxstring );
$ret = "";
if ($terms) {
$ret = "<div class='taxlist'>";
foreach($terms as $term) {
@mkdizajn
mkdizajn / gist:5621965
Created May 21, 2013 18:11
chrome inspector -- test if jquery loaded and if not pull it in the head
javascript:if(!window.jQuery)(function(d,s){s=d.createElement('script');s.src='https://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.js';(d.head||d.documentElement).appendChild(s)})(document);
@mkdizajn
mkdizajn / javascript function to scroll the page to top
Last active December 17, 2015 14:09
javascript function to scroll the page to top
###########################
jquery fn za skrol:
jQuery.fn.skrol = function() {$('body').animate({'scrollTop': this.offset().top}, 'slow', 'swing');};
# USE: $('.class').skrol();
###########################
@mkdizajn
mkdizajn / magento local.xml override stores base url
Last active January 10, 2017 11:02
magento local.xml override stores base url
<config>
<global>
<!-- ... -->
</global>
<stores>
<default>
<web>
<unsecure>
<base_url>http://beispiel.tld/shop/</base_url>
</unsecure>