added searchbox shortcode

This commit is contained in:
2026-01-29 20:41:13 +01:00
parent 61606fd793
commit 7fd99aebbc
7 changed files with 1993 additions and 41 deletions

View File

@@ -5,17 +5,6 @@
*
* @link https://github.com/Duskell
* @since 1.0.0
*
* @package Partnerexpo_Core
* @subpackage Partnerexpo_Core/public
*/
/**
* The public-facing functionality of the plugin.
*
* Defines the plugin name, version, and two examples hooks for how to
* enqueue the public-facing stylesheet and JavaScript.
*
* @package Partnerexpo_Core
* @subpackage Partnerexpo_Core/public
* @author Juhász Levente <juhasz.levente@rendszerepito.hu>
@@ -54,27 +43,26 @@ class Partnerexpo_Core_Public {
}
private function searchbox_shortcode() {
global $searchbox_used;
$searchbox_used = true;
ob_start();
include plugin_dir_path( __FILE__ ) . 'partials/partnerexpo-core-public-searchbox.php';
return ob_get_clean();
}
/**
* Register the stylesheets for the public-facing side of the site.
*
* @since 1.0.0
*/
public function enqueue_styles() {
global $searchbox_used;
/**
* This function is provided for demonstration purposes only.
*
* An instance of this class should be passed to the run() function
* defined in Partnerexpo_Core_Loader as all of the hooks are defined
* in that particular class.
*
* The Partnerexpo_Core_Loader will then create the relationship
* between the defined hooks and the functions defined in this
* class.
*/
wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/partnerexpo-core-public.css', array(), $this->version, 'all' );
if ( ! empty( $searchbox_used ) ) {
wp_enqueue_style( $this->plugin_name . '-searchbox-css', plugin_dir_url( __FILE__ ) . 'css/searchbox.css', [], $this->version, 'all' );
}
}
/**
@@ -83,21 +71,11 @@ class Partnerexpo_Core_Public {
* @since 1.0.0
*/
public function enqueue_scripts() {
global $searchbox_used;
/**
* This function is provided for demonstration purposes only.
*
* An instance of this class should be passed to the run() function
* defined in Partnerexpo_Core_Loader as all of the hooks are defined
* in that particular class.
*
* The Partnerexpo_Core_Loader will then create the relationship
* between the defined hooks and the functions defined in this
* class.
*/
wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/partnerexpo-core-public.js', array( 'jquery' ), $this->version, false );
if ( ! empty( $searchbox_used ) ) {
wp_enqueue_script( $this->plugin_name . '-searchbox-js', plugin_dir_url( __FILE__ ) . 'js/searchbox.js', [], $this->version, true );
}
}
}