最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

shortcode containing other shortcodes not returning content

programmeradmin1浏览0评论

In a WordPress page, I'm using content:

[accordiancontainer]

[accordiantab title="First Tab"]

Tabby ipsum dolor sit amet, kitty sunbathe dolor, feed me.

[accordianending]

[accordiantab title="Second Tab"]

Lay down in your way catnip stuck in a tree, sunbathe kittens.

[accordianending]

[accordiantab title="Third Tab"]

sleep in the sink climb the curtains attack, give me fish.

[accordianending]
[/accordiancontainer]

and I have code:

<?php

add_shortcode( 'accordiancontainer', 'accordian_container_shortcode');

function accordian_container_shortcode($atts, $content) {

  return '<div class="accordion md-accordion" id="accordionEx" role="tablist" aria-multiselectable="true">';

    $content = do_shortcode($content);

    $content .= '</div>';

    return $content;

}

add_shortcode( 'accordiantab', 'accordian_shortcode' );

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

  extract(shortcode_atts(array(
        "title" => '',
    "content" => ''
    ), $atts, 'accordiantab'));

  return '<!-- Start Accordion card -->' . "\n" . '<div class="card">' . "\n" . '<!-- Card header -->' . "\n" . '<div class="card-header" role="tab" id="heading1">';
  return '<a data-toggle="collapse" data-parent="#accordionEx" href="#collapseOne1" aria-expanded="true" aria-controls="collapseOne1">';
  return '<h5 class="mb-0">' . $title . '<i class="fas fa-angle-down rotate-icon"></i></h5>' . "\n" . '</div>';
  return '</a>' . "/n";
  return $content;
  return '</div><!-- End Card header -->';
  return '</div><!-- End Card -->';

}

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

    $GLOBALS["reset_firsttab_flag"] = TRUE;

  return '</div></div>';
  return '<!-- close Accordion wrapper -->';
}

add_shortcode( 'accordianending', 'accordian_ending' );

The only thing output by the shortcode at the top of this question is

<div class="accordion md-accordion" id="accordionEx" role="tablist" aria-multiselectable="true">

Why aren't the inside shortcodes being processed?

Help appreciated. Steve

发布评论

评论列表(0)

  1. 暂无评论