Below, you’ll find a detailed guide on how to add the VK All in One Expansion Unit Shortcodes to your WordPress website, including their parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the VK All in One Expansion Unit Plugin shortcodes not to show or not to work correctly.
Before starting, here is an overview of the VK All in One Expansion Unit Plugin and the shortcodes it provides:
"VK All in One Expansion Unit is a versatile WordPress plugin designed to enhance your website's functionality. The plugin offers a comprehensive suite of tools for customization and optimization."
- [vkExUnit_childs]
- [vkExUnit_contact_section]
- [pageList_ancestor]
- [vkExUnit_sitemap]
VK All in One Expansion Unit [vkExUnit_childs] Shortcode
The vkExUnit_childs shortcode is used to display a list of child pages of a given parent page. It generates a neatly formatted list with page titles, excerpts, and “Read more” buttons.
Shortcode: [vkExUnit_childs]
Examples and Usage
Basic example – The shortcode is used to display child pages of a specified parent page. The parent page is identified by its ID.
[vkExUnit_childs parentId="2" /]
PHP Function Code
In case you have difficulties debugging what causing issues with [vkExUnit_childs]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'vkExUnit_childs', 'vkExUnit_childPageIndex_shortcode' );
Shortcode PHP function:
function vkExUnit_childPageIndex_shortcode( $parentId = null, $classes = '' ) {
// null じゃなくstring(0) "" が来る事がある
if ( $parentId === null || $parentId == '' ) {
global $is_pagewidget;
if ( $is_pagewidget ) {
global $widget_pageid;
$parentId = $widget_pageid;
} else {
global $post;
if (
! is_page()
|| ! get_post_meta( $post->ID, 'vkExUnit_childPageIndex', true )
) {
return false;
}
$parentId = $post->ID;
}
}
$args = array(
'post_type' => 'page',
'posts_per_page' => -1,
'order' => 'ASC',
'orderby' => 'menu_order',
'post_parent' => $parentId,
);
$childrens = get_posts( $args );
if ( empty( $childrens ) ) {
wp_reset_query();
return false; }
$childPageList_html = PHP_EOL . '<div class="veu_childPage_list ' . $classes . '">' . PHP_EOL;
foreach ( $childrens as $children ) :
$postExcerpt = veu_child_page_excerpt( $children );
// Page Item build
$childPageList_html .= '<a href="' . esc_url( get_permalink( $children->ID ) ) . '" class="childPage_list_box veu_card"><div class="childPage_list_box_inner veu_card_inner">';
$childPageList_html .= '<h3 class="childPage_list_title veu_card_title">' . wp_kses_post( $children->post_title ) . '</h3>';
$childPageList_html .= '<div class="childPage_list_body">';
$childPageList_html .= apply_filters( 'veu_child_index_thumbnail', get_the_post_thumbnail( $children->ID, 'thumbnail' ), $children->ID );
/*
Customize example
add_filter( 'veu_child_index_thumbnail', function( $return, $id ){
$return = '<div class="xxx">' . get_the_post_thumbnail( $id, 'thumbnail' ) . '</div>';
return $return;
}, 10, 2 );
*/
$childPageList_html .= '<p class="childPage_list_text">' . $postExcerpt . '</p>';
$childPageList_html .= '<span class="childPage_list_more btn btn-primary btn-sm">' . apply_filters( 'veu_childPage_list_read_more_txt', __( 'Read more', 'vk-all-in-one-expansion-unit' ) ) . '</span>';
$childPageList_html .= '</div>';
$childPageList_html .= '</div></a>' . PHP_EOL;
endforeach;
$childPageList_html .= PHP_EOL . '</div><!-- [ /.veu_childPage_list ] -->' . PHP_EOL;
wp_reset_query();
return $childPageList_html;
}
Code file location:
vk-all-in-one-expansion-unit/vk-all-in-one-expansion-unit/inc/child-page-index/child-page-index.php
VK All in One Expansion Unit [vkExUnit_contact_section] Shortcode
The VK All in One Expansion Unit shortcode ‘vkExUnit_contact_section’ is designed to add a contact section to your webpage. This shortcode utilizes the ‘veu_contact-layout-horizontal’ layout, rendering a horizontal contact form on the page. It’s a quick and efficient way to integrate a contact form into your WordPress site.
Shortcode: [vkExUnit_contact_section]
Examples and Usage
Basic example – A simple use of the shortcode to display a contact section in a horizontal layout.
[vkExUnit_contact_section]
PHP Function Code
In case you have difficulties debugging what causing issues with [vkExUnit_contact_section]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'vkExUnit_contact_section', array( $this, 'shortcode' ) );
Shortcode PHP function:
function shortcode() {
return self::render_contact_section_html( 'veu_contact-layout-horizontal', true );
}
Code file location:
vk-all-in-one-expansion-unit/vk-all-in-one-expansion-unit/inc/contact-section/contact-section.php
VK All in One Expansion Unit [pageList_ancestor] Shortcode
The ‘pageList_ancestor’ shortcode from vk-all-in-one-expansion-unit plugin is designed to list the ancestor pages of a given page. When applied, it retrieves the ancestors of the current page and generates a list. It returns an empty string if the page doesn’t have any ancestors or if the page is not a ‘page’ post type. The generated list is then stylized with CSS classes and returned as a section of HTML.
Shortcode: [pageList_ancestor]
Examples and Usage
Basic example – Display a list of child pages for the current page using the ‘pageList_ancestor’ shortcode.
[pageList_ancestor]
PHP Function Code
In case you have difficulties debugging what causing issues with [pageList_ancestor]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'pageList_ancestor', 'vkExUnit_pageList_ancestor_shortcode' );
Shortcode PHP function:
function vkExUnit_pageList_ancestor_shortcode( $class_name = '', $force = false ) {
global $is_pagewidget;
if ( $is_pagewidget ) {
global $widget_pageid;
$post = get_post( $widget_pageid );
} else {
global $post;
if(
!$force
&& (
! is_page()
|| ! get_post_meta( $post->ID, 'vkExUnit_pageList_ancestor', true )
)
){
return '';
}
}
if ( $post->ancestors ) {
foreach ( $post->ancestors as $post_anc_id ) {
$post_id = $post_anc_id;
}
} else {
$post_id = $post->ID;
}
if ( $post_id ) {
$children = wp_list_pages( array(
'title_li' => '',
'child_of' => $post_id,
'echo' => 0
) );
$classes = 'veu_pageList_ancestor veu_card';
if ( ! empty( $class_name ) ) {
$classes .= ' ' . $class_name;
}
if ( $children ) {
$pageList_ancestor_html = '<section class="' . esc_attr( $classes ) . '">';
$pageList_ancestor_html .= '<div class="veu_card_inner">';
$pageList_ancestor_html .= '<h3 class="pageList_ancestor_title veu_card_title"><a href="' . get_permalink( $post_id ) . '">' . get_the_title( $post_id ) . '</a></h3>';
$pageList_ancestor_html .= '<ul class="pageList">';
$pageList_ancestor_html .= $children;
$pageList_ancestor_html .= '</ul>';
$pageList_ancestor_html .= '</div>';
$pageList_ancestor_html .= '</section>';
} else {
return '';
}
}
wp_reset_query();
wp_reset_postdata();
return wp_kses_post( $pageList_ancestor_html );
}
Code file location:
vk-all-in-one-expansion-unit/vk-all-in-one-expansion-unit/inc/page-list-ancestor/page-list-ancestor.php
VK All in One Expansion Unit [vkExUnit_sitemap] Shortcode
The VK All in One Expansion Unit plugin shortcode, ‘vkExUnit_sitemap’, generates a dynamic sitemap for your WordPress site. It simplifies navigation, enhancing user experience.
Shortcode: [vkExUnit_sitemap]
Examples and Usage
Basic example – The vkExUnit_sitemap shortcode is used to display a sitemap on your WordPress website. This gives your users a quick overview of all the pages on your site.
[vkExUnit_sitemap /]
PHP Function Code
In case you have difficulties debugging what causing issues with [vkExUnit_sitemap]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode( 'vkExUnit_sitemap', 'vkExUnit_sitemap' );
Shortcode PHP function:
f
Code file location:
vk-all-in-one-expansion-unit/vk-all-in-one-expansion-unit/inc/sitemap-page/sitemap-page.php
Conclusion
Now that you’ve learned how to embed the VK All in One Expansion Unit Plugin shortcodes, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.
Leave a Reply