Need to echo post title with a shortcode -
i have shortcode need echo post name before photo tour. shortcode implemented below. appreciated.
/** * [separator_photoheading size="2" type="" align="center" id=""]photo tour[/separator_photoheading] * * heading photo separator * * @param align [left, center, right] * @param id [text] * @param size [#: 1-6] * @param type [text] */ if ( ! function_exists( 'wm_shortcode_separator_photoheading' ) ) { function wm_shortcode_separator_photoheading( $atts, $content = null ) { extract( shortcode_atts( array( 'align' => '', 'id' => '', 'size' => 2, 'type' => 'uniform', ), $atts) ); //validation $aligns = array( 'center', 'right' ); $align = ( in_array( trim( $align ), $aligns ) ) ? ( ' text-' . trim( $align ) ) : ( '' ); $id = ( trim( $id ) ) ? ( ' id="' . sanitize_title( $id ) .'"' ) : ( '' ); $size = ( 1 <= absint( $size ) && 6 >= absint( $size ) ) ? ( absint( $size ) ) : ( '2' ); $type = ( 'uniform' == trim( $type ) ) ? ( ' apply-top-margin style-uniform' ) : ( ' style-' . trim( $type ) ); $attachments = get_children( array('post_parent' => get_the_id(), 'post_type' => 'attachment', 'post_mime_type' => 'image') ); if ( $attachments ) { //output return '<div class="clear"></div><h' . $size . $id . ' class="separator-heading' . esc_attr( $type ) . esc_attr( $align ) . '"><span class="text-holder">' . do_shortcode( strip_tags( trim( $content ), '<img><strong><span><small><em><b><i>' ) ) . '</span><span class="pattern-holder"></span></h' . $size . '>'; } } } // /wm_shortcode_separator_photoheading add_shortcode( 'separator_photoheading', 'wm_shortcode_separator_photoheading' );
Comments
Post a Comment