Skip to content

Instantly share code, notes, and snippets.

@ChrisLTD
ChrisLTD / gist:5877800
Created June 27, 2013 16:11
Loop through all custom taxonomy terms for a post type
<?php
$post_type = 'post';
// Get all the taxonomies for this post type
$taxonomies = get_object_taxonomies( (object) array( 'post_type' => $post_type ) );
foreach( $taxonomies as $taxonomy ){
// Gets every "category" (term) in this taxonomy to get the respective posts
$terms = get_terms( $taxonomy );
foreach( $terms as $term ){
echo $term->name;
}
<?php
function the_date_range($args) {
global $post;
$default = array(
'start_field' => 'start_date',
'end_field' => null,
'base_format' => 'Ymd',
'post_id' => $post->ID,
'separator' => '<span class="date-separator">&ndash;</span>',
'month_format' => 'F',
@ultimatemember
ultimatemember / gist:f7eab149cb33df735b08
Last active May 30, 2024 18:03
Extend Ultimate Member Account page with custom tabs/content
/* add new tab called "mytab" */
add_filter('um_account_page_default_tabs_hook', 'my_custom_tab_in_um', 100 );
function my_custom_tab_in_um( $tabs ) {
$tabs[800]['mytab']['icon'] = 'um-faicon-pencil';
$tabs[800]['mytab']['title'] = 'My Custom Tab';
$tabs[800]['mytab']['custom'] = true;
return $tabs;
}
add_filter( 'wpseo_breadcrumb_links', 'jj_wpseo_breadcrumb_links' );
function jj_wpseo_breadcrumb_links( $links ) {
//pk_print( sizeof($links) );
if( sizeof($links) > 1 ){
array_pop($links);
}
return $links;
}
@temsool
temsool / Image ratio on featured image widget elementor.php
Created October 4, 2018 19:57
Image ratio on featured image widget elementor
var passField = $form.find('input[data-name=password]');
passField.wrap("<div class='ff_input-group'></div>");
passField.after('<div class="ff_input-group-append"><span class="ff_input-group-text"><i style="cursor:pointer;" class="dashicons dashicons-hidden toggle-password"> </i></span></div>');
$form.find(".toggle-password").click(function() {
$(this).toggleClass("dashicons-visibility dashicons-hidden");
if (passField.attr("type") == "password") {
passField.attr("type", "text");
} else {
@hsntgm
hsntgm / functions.php
Last active February 7, 2024 15:40
woocommerce-nvi-tc-kimlik-dogrulama
<?php
function strto($to, $str) {
if ('lower' === $to) {
return mb_strtolower(str_replace(array('I', 'Ğ', 'Ü', 'Ş', 'İ', 'Ö', 'Ç'), array('ı', 'ğ', 'ü', 'ş', 'i', 'ö', 'ç'), $str), 'utf-8');
} elseif ('upper' === $to) {
return mb_strtoupper(str_replace(array('ı', 'ğ', 'ü', 'ş', 'i', 'ö', 'ç'), array('I', 'Ğ', 'Ü', 'Ş', 'İ', 'Ö', 'Ç'), $str), 'utf-8');
} else {
trigger_error('Lütfen geçerli bir strto() parametresi giriniz.', E_USER_ERROR);
}