This file contains 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 | |
//Get all terms associated with post in taxonomy 'category' | |
$terms = get_the_terms(get_the_ID(),'category'); | |
//Get an array of their IDs | |
$term_ids = wp_list_pluck($terms,'term_id'); | |
//Get array of parents - 0 is not a parent | |
$parents = array_filter(wp_list_pluck($terms,'parent')); |
This file contains 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 $terms = get_the_terms( $post->ID , 'product-category' ); | |
if ( $terms != null ){ | |
foreach( $terms as $term ) { | |
if($term->parent == 0){ | |
$theterm = $term->slug; | |
} | |
unset($term); | |
} } | |
?> |
This file contains 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 | |
$query = new EntityFieldQuery(); | |
$query->entityCondition('entity_type', 'node') | |
->propertyCondition('status', 1) | |
->propertyCondition('type', array('slider_gornji')) | |
->propertyOrderBy('created', 'DESC') | |
->range(0, 5); | |
$result = $query->execute(); | |
$nodes = node_load_multiple(array_keys($result['node'])); |
This file contains 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 $class = ($x%2 == 0)? 'odd': 'even'; ?> |
This file contains 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 | |
//Add this to functions PHP | |
function pippin_add_taxonomy_filters() { | |
global $typenow; | |
// an array of all the taxonomyies you want to display. Use the taxonomy name or slug | |
$taxonomies = array('product-category'); | |
// must set this to the post type you want the filter(s) displayed on |
This file contains 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 | |
/*use print_r($user_profile['field_name']); to check out the array */ | |
/*Some examples of this method */ | |
<li><?php print $user_profile['field_drzava']['#title'] ?>: <?php print $user_profile['field_drzava'][0]['#markup'] ?></li> | |
<li><?php print $user_profile['field_tel_']['#title'] ?> <?php print $user_profile['field_tel_'][0]['#markup'] ?></li> | |
<li><?php print $user_profile['field_fax_']['#title'] ?> <?php print $user_profile['field_fax_'][0]['#markup'] ?></li> | |
<li><?php print $user_profile['field_sjediste_firme_']['#title'] ?> <?php print $user_profile['field_sjediste_firme_']['#items'][0]['value'] ?></li |
This file contains 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 | |
$username = $node->name; | |
print $username; | |
?> |
This file contains 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($node->type=='node-type-name'){ ?> |
This file contains 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 | |
$post_id = $wp_query->post->ID; // get post ID | |
?> | |
<h2><?php echo get_the_title($post_id); ?></h2> | |
/* If using WPML for translation then */ | |
<h2><?php echo get_the_title(icl_object_id($post_id, 'page', false)); ?></h2> |
This file contains 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 Preferences - Settings user | |
"tab_size": 8, | |
"translate_tabs_to_spaces": true, | |
"auto_indent": true, | |
"detect_indentation": false |