Skip to content

Commit

Permalink
load shortcodes as seperate files
Browse files Browse the repository at this point in the history
  • Loading branch information
bfiessinger committed May 25, 2021
1 parent a4e9470 commit e976afc
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 21 deletions.
33 changes: 12 additions & 21 deletions core/inc/shortcodes.php
Original file line number Diff line number Diff line change
@@ -1,23 +1,14 @@
<?php

// Create Shortcode wppedia_navigation
// Shortcode: [wppedia_navigation]
function create_wppedia_navigation_shortcode() {

ob_start();
wppedia_get_template_part('nav/char', 'navigation');
return ob_get_clean();

}
add_shortcode( 'wppedia_navigation', 'create_wppedia_navigation_shortcode' );

// Create Shortcode wppedia_searchform
// Shortcode: [wppedia_searchform]
function create_wppedia_searchform_shortcode() {

ob_start();
wppedia_get_template_part('search/form');
return ob_get_clean();

}
add_shortcode( 'wppedia_searchform', 'create_wppedia_searchform_shortcode' );
/**
* Register custom shortcodes
* the code for shortcodes is available in the shortcodes
* folder
*
* @since 1.1.5
*/

defined( 'ABSPATH' ) || die();

require_once __DIR__ . '/shortcodes/navigation.php';
require_once __DIR__ . '/shortcodes/searchform.php';
22 changes: 22 additions & 0 deletions core/inc/shortcodes/navigation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

/**
* Register shortcode to display the WPPedia initial char
* navigation
*
* @shortcode_name wppedia_navigation
* @usage [wppedia_navigation]
*
* @since 1.1.5
*/

defined( 'ABSPATH' ) || die();

function create_wppedia_navigation_shortcode() {

ob_start();
wppedia_get_template_part('nav/char', 'navigation');
return ob_get_clean();

}
add_shortcode( 'wppedia_navigation', 'create_wppedia_navigation_shortcode' );
21 changes: 21 additions & 0 deletions core/inc/shortcodes/searchform.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

/**
* Register shortcode to display the WPPedia searchform
*
* @shortcode_name wppedia_searchform
* @usage [wppedia_searchform]
*
* @since 1.1.5
*/

defined( 'ABSPATH' ) || die();

function create_wppedia_searchform_shortcode() {

ob_start();
wppedia_get_template_part('search/form');
return ob_get_clean();

}
add_shortcode( 'wppedia_searchform', 'create_wppedia_searchform_shortcode' );

0 comments on commit e976afc

Please sign in to comment.