Create a widget to use shortcode?
You can find more information in the Widgets API
You can find more information in the Widgets API
You need to setup postdata in order to set the $post global in order to make template tags available for this to work foreach ( $myposts as $post ) { setup_postdata( $post ); get_template_part( ‘content’ ); } wp_reset_postdata();
Check this out, it may guide you in the direction you need: First: register_sidebar( array( ‘name’ => ‘Social Media button’, ‘id’ => ‘smb’, ‘before_widget’ => ‘<li>’, ‘after_widget’ => ‘</li>’, ) ); Second code: public function widget( $args, $instance ) { $output = $args[‘before_widget’]; $output .= ‘<a href=”‘ . $instance[‘url’] . ‘” class=”fa fa-‘ . $args[‘icon_title’] … Read more
Since it sounds like you’re trying to do this without code I would do it this way: Create an ‘Advertisement’ post type which supports categories. Then use a ‘Related Posts’ widget that allows you to select custom post types as well as related categories. Possibly one of these And use the widget settings to call … Read more
In the function that you’re hooking into user_register, you need to create the user and save the values. First, I’d recommend using wp_insert_user() instead of wp_create_user(). You might do something like this: $userdata = array( ‘user_email’ => $email_address, ‘user_login’ => $user_name, // this is automatically salted ‘user_pass’ => ‘plain_text_password’, ); // this function returns the … Read more
As far I understood you want to assign the order number like $order_number = order_generator($email) inside the widget class. Yes, you can do it that way unless the order_generator is in another class. If you order_generator function is in another class then first you need to instantiate the class then call the method like $instance_of_your_class->order_generator($email). … Read more
What is BOM? The UTF-8 byte order mark or simply UTF-8 BOM is a series of bytes that helps the reader to understand the encoding of the current document. These 3 bytes are: EF BB BF Or simply the Unicode character : U+FEFF In a plugin file encoded as BOM, these bytes will be output … Read more
Shortcodes need to return data, not echo it – use output buffering to capture the output of the include and return it: function related_category_sidebar() { ob_start(); include WP_PLUGIN_DIR . ‘/sabai-directory/assets/templates/template_related_category.php’; return ob_get_clean(); } Then you will also need to do as Charles suggested and enable shortcodes for text widgets: add_filter( ‘widget_text’, ‘do_shortcode’, 11 );
on line 41 you forget the “,” at the end ‘offset’ => ‘1’,
If you don’t want to use a plugin, there’s a really good explanation from CSS Tricks about how to convert tags from “flat” to “hierarchical”. https://css-tricks.com/how-and-why-to-convert-wordpress-tags-from-flat-to-hierarchical/