How is this shortcode working?
-
I’m looking at a website for a client who wants to add a new page into a list on the homepage. The site was designed by a previous designer.
I’m stumped on how it’s functioning. I googled the shortcodes and found references via wordpress.com but they all referenced that the child pages of the parent would be listed and in this case, these pages are all parents – no child pages.
On the homepage, the following shortcode is displaying a list of courses:
—————————————————-
[child-list parent=’courses’]
—————————————————-The courses which all show up in this area do NOT have a parent page. I have looked through the code and found the following in functions.php.
—————————————————-function child_list($atts,$content = null){ extract(shortcode_atts(array( 'parent' => '', ), $atts)); ob_start(); $page = get_page_by_title($parent); $pageID = $page->ID; $args = array('post_type'=>'page','order'=>'ASC','post__in' => array(50,60,78,80,67,63)); $loop = new WP_Query($args); echo '<div id="child-list">'; while ($loop->have_posts()) : $loop->the_post(); echo '<div class="child-list-wrap">'; if ( has_post_thumbnail() ) { the_post_thumbnail('course-img'); } else { echo '<div class="no-thumb">No<br> Thumb</div>'; } echo '<a href="'.get_permalink().'">'.get_the_title().'</a>'; echo '</div>'; endwhile; echo '</div>'; wp_reset_query(); $output = ob_get_clean(); return $output; } add_shortcode('child-list','child_list');
—————————————————-
How are the course pages to be included being defined???? I even duplicated an existing course page and it was not added automatically so I need to find where/how these are defined. Any help is greatly appreciated.
- The topic ‘How is this shortcode working?’ is closed to new replies.