su_shortcode_siblings

The shortcodes-ultimate su shortcode siblings function.

Published Date - February 15, 2021

Description

su_shortcode_siblings( $atts, $content );

Parameters

  1. $atts

  2. $content


Usage

The following example is for adding a hook callback.

if ( !function_exists( 'su_shortcode_siblings' ) ) {
    require_once ABSPATH . PLUGINDIR . 'shortcodes-ultimateshortcodes-ultimate/includes/shortcodes/siblings.php';
}

// The input(s). 
$atts = null;
$content = null;

// NOTICE! Understand what this does before running.
$result = su_shortcode_siblings( $atts, $content );
            

Defined

The function is defined in the following location(s).

shortcodes-ultimate/includes/shortcodes/siblings.php

function su_shortcode_siblings( $atts = null, $content = null ) {

	$atts = shortcode_atts( array(
			'depth' => 1,
			'class' => ''
		), $atts, 'siblings' );

	global $post;

	if ( ! ( $post instanceof WP_Post ) ) {
		return;
	}

	$return = wp_list_pages( array(
			'title_li' => '',
			'echo'     => 0,
			'child_of' => $post->post_parent,
			'depth'    => $atts['depth'],
			'exclude'  => $post->ID
		) );

	return $return
		? '<ul class="su-siblings' . su_get_css_class( $atts ) . '">' . $return . '</ul>'
		: '';
}