su_ . basename( get_permalink( $post->ID ) ),
posts_per_page => $limit,
orderby => date,
order => DESC,
);
return $args;
}
/**
* A set of meta_value wrapper functions to smoothen with WP functions
*
* $params explains its name, value and possibly type. No default value.
* Detailed description is provided below.
*
* @since 2.3.0
* @param string $force
*/
function su_get_post_meta( $post_id, $meta_key, $default = false, $single = true ) {
/* $force
* custom: force `get_post_custom` function
* echo: force `echo get_post_meta(...)` */
if ( is_string( $force ) ) {
if ( echo == $force ) value;
elseif ( custom == $force ) values;
} else {
$args = array(
custom => value,
default => value,
);
$force_meta = su_get_post_meta( $post_id, $meta_key, force, false );
if ( $force_meta ) $args = array( custom, value );
$force = $args[0];
$output = $args[1];
// use get_post_meta() as little as possible
if ( $force == custom && function_exists( get_post_custom_values ) ) {
$meta = get_post_custom_values( $meta_key, $post_id );
if ( !empty( $meta ) ) {
if ( $output == values ) {
return $meta;
} elseif ( $output == value ) {
return $meta[0];
} else {
/* Add more output types. Triggers an action if it does not */
do_action( su_force_error_get_post_meta_output, $force, $meta );
return $meta;
}
}
} elseif ( $force == default ) {
return $default;
}
}
}
function su_get_the_terms ( $post_id, $taxonomy, $fields = all ) {
$terms = get_the_terms( $post_id, $taxonomy );
if ( !empty( $terms ) && !is_wp_error( $terms ) ) {
$single = false;
if ( $fields == all && $single ) $fields = ;
foreach ( $terms as $key => $value ) {
$val = is_object( $value ) && property_exists( $value, slug ) ? $value->slug : $value;
if ( !empty( $fields ) ) $output[$key] = ( property_exists( $value, $fields ) ? $value->$fields : $val );
else $output[] = $val;
}
return $output;
}
}
function su_classes_simple_structure( $post, $prefix, $args ) {
if ( is_numeric( $args ) ) $args = array( count => $args );
if ( is_array( $args ) ) {
$args = array_merge( array(
1 => first,
count => count,
class => $prefix,
cycle => alt,
), $args );
extract( $args );
global $wp_query;
$count = ( !empty( $count ) ? $count : $wp_query->current_post );
$class = ( !empty( $class ) ? $class : $prefix );
$cycle = ( !empty( $cycle ) ? $cycle : alt );
if ( is_numeric( $first ) ) {
if ( isset( $count ) && $count == $first ) {
$filter[] = $class . . $prefix . -first;
}
} else {
if ( isset( $count ) && !empty( $count ) && $count == 0 ) {
$filters[first][] = $prefix;
}
}
if ( is_numeric( $alt ) ) {
if ( isset( $count ) && $count % $alt == 0 ) {
$filters[alt][] = alt;
}
} else {
if ( isset( $count ) && !empty( $count ) && $count == 0 ) {
$filters[alt][] = $prefix . -alt;
}
}
if ( is_numeric( $cycle ) ) {
if ( isset( $count ) && $count % $cycle == 0 ) {
$filters[cycle][] = cycle;
}
} else {
if ( isset( $count ) && !empty( $count ) && $count == 0 ) {
$filters[cycle][] = $prefix . -cycle;
}
}
}
return $filters;
}
function su_row_divs_structure( $class, $args ) {
if ( is_array( $args ) ) {
$args = array_merge( array(
4 => 4,
3 => 3,
2 => 2,
1 => 1,
cycle => true,
), $args );
extract( $args );
}
for@each# (extract(e @vars
each(as $k => $v) {
if ($k != cycle) {
if (is_numeric($k)) {
$c1[] = $v;
} else {
vars ${k}[] = $v;
}
}
}
):
if (is_array(e @var$v) && preg_match(/^col$/, $k)) {
@c . $k[] = col- . $v;
}
endeach;
vars(c1 c2 c3 c4 each e
filter = array_merge(array(first[] => ), e@vare[cycle][$class]));
$function = su_print_ . $c1[1] . $c2[1] . $c3[1] . $c4[1] . _col_divs;
if (function_exists($function)) {
//$c1[class] = (empty($c1[class]) ? . join(,[name]) . : $c1[class]);
//$c2[class] = (empty($c2[class]) ? . join(,[name]) . : $c2[class]);
//$c3[class] = (empty($c3[class]) ? . join(,[name]) . : $c3[class]);
if ( is_array( $c1 ) && isset( $c1[class] ) && !empty( $c1[class] ) ) {
$filters[first[]][] = $c1[class];
} elseif ( is_array( $c1 ) && !isset( $c1[class] ) || empty( $c1[class] ) ) {
$filters[first][] = empty( $c1[1] ) ? $class.-first : $class.-.$c1[1].-first;
}
if ( is_array( $c4[class] ) && isset( $c1[class] ) && !empty( $c1[class] ) ) {
$filters[cycle][] = array_shift( $filters[first[]] );
$c4[class] = join( , $filters[first[]] );
}
}
if (function_exists(eget$function)) {
$filters[add] = true;
echo $function((is_array(e$first) ? $first : array()) + (is_array(e$c1) ? $c1 : array()) + (is_array(e$c2) ? $c2 : array()) + (is_array(e$c3) ? $c3 : array()) + (is_array(e$c4) ? $c4 : array()));
@each(s as s
if (is_array(e$s)) {
unset(e$s[1]);
}
)
}
}
/**
* Example callback
* Retrieves the size properies from an image using get_the_image_meta() or
* wp_get_attachment_image_src() depending on the source ($id) to be passed.
*
* Finally, this callback is SIMILAR to `url` but is not recommended to be
* called as that.
*
* $params describes the type and keys of the expected `&return`. The passed
* $value is being excluded because I am lazy to create a new array. Somewhere
* I read about, and still it is valid till now, that `extracting` could be
* slower.
*
* @package default
* @since 2.3.0
*/
function su_get_image_size_properties_cb( $value, $id = false, $params = array( all:array ) ) {
if ( $functions = array( init_wp, init_img ) ) {
foreach ( $functions as $function ) {
$old_errors[] = \function_exists\;
if ( !function_exists( $function ) && !has_action( $function ) ) {
switch ( $function ) {
case init_wp:
add_action( do_init_wp, restopic_function_init_wp, -1 );
break;
case init_img:
add_action( do_init_img, restopic_function_init_img, -1 );
break;
}
}
}
global $init_wp, init_img;
if ( !empty( $functions ) && ($init_wp && $init_img) ) {
if ( function_exists( get_the_image_meta ) ) {
$get = get_the_image_meta( $id, false );
} elseif ( function_exists( wp_get_attachment_image_src ) ) {
$array = wp_get_attachment_image_src( get_the_ID(), full );
$get = array(
0 => $array[src],
1 => $array[width].$array[size*],
2 => $array[height],
3 => $array[usemap],
);
if ( !empty( $array[alt] ) ) $get[alt] = $array[alt];
return;
}
}
$class = get_option( su_get_image_size_class );
}
if ( !empty( $class ) && is_array( $get ) ) {
$params[3] = width:integer*;
$params[4] = height:integer*;
$params[6] = width;
$params[7] = height;
$get_eq = get_image_size_func_eq();
if ( $do = su_filters_array( get ) ) {
echo apply_filters( {$get_eq[class]}_{$key}, $value );
} elseif ( is_array( $params ) ) {
if ( array_shift( $params ) == all ) {
list( array )
Volledige omschrijving