This file contains hidden or 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 /* Using this instead the_category */ | |
function the_category_filter($thelist,$separator=' ') { | |
if(!defined('WP_ADMIN')) { | |
//list the category names to exclude | |
$exclude = array('Featured', 'Show'); | |
$cats = explode($separator,$thelist); | |
$newlist = array(); | |
foreach($cats as $cat) { | |
$catname = trim(strip_tags($cat)); | |
if(!in_array($catname,$exclude)) |
This file contains hidden or 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 this to functions.php */ | |
<?php | |
function pj_featured_img_title() { | |
global $post; | |
$pj_thumbnail_id = get_post_thumbnail_id($post->ID); | |
$pj_thumbnail_image = get_posts(array('p' => $pj_thumbnail_id, 'post_type' => 'attachment', 'post_status' => 'any')); | |
if ($pj_thumbnail_image && isset($pj_thumbnail_image[0])) { | |
return $pj_thumbnail_image[0]->post_title; | |
} |
This file contains hidden or 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
/* == WordPress WYSIWYG Editor Styles == */ | |
.entry-content img { | |
margin: 0 0 1.5em 0; | |
} | |
.alignleft, img.alignleft { | |
margin-right: 1.5em; | |
display: inline; | |
float: left; | |
} |
This file contains hidden or 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 | |
function is_tree($pid) { | |
global $post; | |
$anc = get_post_ancestors( $post->ID ); | |
foreach($anc as $ancestor) { | |
if(is_page() && $ancestor == $pid) { | |
return true; | |
} | |
} | |
if(is_page()&&(is_page($pid))) |
This file contains hidden or 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 | |
function excerpt($limit) { | |
$excerpt = explode(' ', get_the_excerpt(), $limit); | |
if (count($excerpt)>=$limit) { | |
array_pop($excerpt); | |
$excerpt = implode(" ",$excerpt).'...'; | |
} else { | |
$excerpt = implode(" ",$excerpt); | |
} | |
$excerpt = preg_replace('`\[[^\]]*\]`','',$excerpt); |
This file contains hidden or 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 | |
/* For adding custom field to gallery popup */ | |
function ime_autora_field($form_fields, $post) { | |
$form_fields["ime-autora"] = array( | |
"label" => __("Autor"), | |
"input" => "text", | |
"value" => get_post_meta($post->ID, "_ime-autora", true), | |
"helps" => __("Ime autora slike"), |
This file contains hidden or 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 if ( has_post_thumbnail()) { | |
$large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'full'); | |
echo $large_image_url[0]; | |
} | |
?> |
This file contains hidden or 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 | |
$find = array("vlaue1", "value2", "value3"); | |
$replace = array("replacevalue1","replacevalue2","replacevalue3"); | |
str_ireplace($find,$replace,$string); | |
?> |
This file contains hidden or 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 | |
// Just add it to functions.php | |
// Add currency / symbol | |
add_filter( 'woocommerce_currencies', 'add_rand_currency' ); | |
add_filter( 'woocommerce_currency_symbol', 'add_rand_currency_symbol' ); | |
function add_rand_currency( $currencies ) { | |
$currencies['HRK'] = __( 'Hrvatska kuna (Kn)', 'woothemes' ); |
This file contains hidden or 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 | |
//Just put it in functions.php | |
/* Number of columns in Woocommerce Loop */ | |
global $woocommerce_loop; | |
$woocommerce_loop['columns'] = 2; |