function coronastatics_widgetreg()
{
register_widget('corona_bd_widget');
register_widget('corona_bd_widget_world');
}
add_action('widgets_init', 'coronastatics_widgetreg');
and i’m calling this functions as __construct. below is the code:
<?php
class corona_bd_widget extends WP_Widget{
public function __construct()
{
$widget_ops = array(
'classname' => 'corona_bd_widget',
'description' => 'Display Bangladesh Live CoronaVirus (Covid-19) Real-Time Data'
);
parent::__construct('corona_bd_widget', 'CoronaStatics Bangladesh', $widget_ops);
}
// output the widget content on the front-end
public function widget($args, $instance)
{
echo $args['before_widget'];
if (!empty($instance['title'])) {
echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title'];
}
$data = json_decode(coronastatics_bangladeshapi());
?>
the codes are working good. but now i want to change the “corona_bd_widget” to “coronastatics_bangladeshwidget”, but while i’m changing this “corona_bd_widget” to “coronastatics_bangladeshwidget” it’s not showing anything into the widget area of my website. can you please explain what is the issue?
thanks.
]]>I am developing a wordpress plugin and I want to include all wordpress functions to my php file.
Can you please tell me how to start developing with wordpress?
Thanks.
]]>this function shuffle numbers,
function gen_num()
{
$caracteres = “012345678910111213141516171819”;
$mistura = substr(str_shuffle($caracteres),0,15);
print $mistura;
I needed a condition to print or not the numbers at the posts, and the @leglesslizard User helped me. It works perfectly,
function gen_num()
{
global $post;
$mistura = get_post_meta( $post->ID, ‘my_custom_meta’, true );
if ( ” == $mistura ) {
$caracteres = “012345678910111213141516171819”;
$mistura = substr(str_shuffle($caracteres),0,10);
update_post_meta( $post->ID, ‘my_custom_meta’, $mistura );
}
print $mistura;
}
I am now trying to make arrays and I can not!
function shuflenames()
{
$input = array(“Neo”, “Morpheus”, “Trinity”, “Cypher”, “Tank”);
$rand_keys = array_rand($input, 2);
echo $input[$rand_keys[0]] . “\n”;
echo $input[$rand_keys[1]] . “\n”;
my failed attempt:
function shuflenames()
{
global $post;
$input = get_post_meta( $post->ID, ‘names’, true );
if ( ” == $input ) {
$input = array(“Neo”, “Morpheus”, “Trinity”, “Cypher”, “Tank”);
$rand_keys = array_rand($input, 2);
update_post_meta( $post->ID, ‘names’, $input );
}
echo $input[$rand_keys[0]] . “\n”;
echo $input[$rand_keys[1]] . “\n”;
}
Thanks to all, Best Regards.
]]>I have been using this plugin for a few months now and it’s really helping me.
I do have one question.
Would it be possible to add a shortcode pointing to the URLs that WordPress creates when a comment is in moderation?
Normally you get a notification from WP saying you can:
Approve the comment by clicking on an URL such as website.com/wp-admin/comment.php?action=approve&c=ID
Is it possible to add this functionality? There is only one URL shortcode for comments in BNFW plugin (Permalink: [permalink]) and it’s to the comment itself but when a comment is in moderation, that link doesn’t really point to anything since the comment hasn’t been approved just yet.
Could we get add this functionality in BNFW so the email for new comments could contain URLs for approving, spamming, or adding it to the bin?
Or maybe this can already be done? If so, how?
https://www.ads-software.com/plugins/bnfw/
]]>The current version of plugin generates invalid HTML code. It is because the “init.php” script is importing stylesheet files using the “wp_print_scripts” action.
This action should not be used in the most recent WordPress versions. It as well adds stylesheets at the footer of <body>, which provokes the HTML5 validity errors.
The both wp_print_scripts
calls in that file should be replaced by “wp_enqueue_scripts“. This puts stylesheet import into the <head> and solves the HTML5 validity issues.
I hope developers will consider my comment in the future releases of this plugin.
Thank you
https://www.ads-software.com/plugins/easy-logo-slider/
]]>function $user_identity() {
global $current_user;
get_currentuserinfo();
$user_identity = $current_user->display_name;
echo ‘Username: ‘ . $current_user->user_login . “\n”;
echo ‘User email: ‘ . $current_user->user_email . “\n”;
echo ‘User first name: ‘ . $current_user->user_firstname . “\n”;
echo ‘User last name: ‘ . $current_user->user_lastname . “\n”;
echo ‘User display name: ‘ . $current_user->display_name . “\n”;
echo ‘User ID: ‘ . $current_user->ID . “\n”;
}
And i want to call it in my header like if( is_user_logged_in()) {
echo “Hello, $user_idenity”; }
else {
echo “Hello, Visitor”;
};
Can you please help in doing so.
]]>function $user_identity() {
global $current_user;
get_currentuserinfo();
$user_identity = $current_user->display_name;
echo ‘Username: ‘ . $current_user->user_login . “\n”;
echo ‘User email: ‘ . $current_user->user_email . “\n”;
echo ‘User first name: ‘ . $current_user->user_firstname . “\n”;
echo ‘User last name: ‘ . $current_user->user_lastname . “\n”;
echo ‘User display name: ‘ . $current_user->display_name . “\n”;
echo ‘User ID: ‘ . $current_user->ID . “\n”;
}
And i want to call it in my header like if( is_user_logged_in()) {
echo “Hello, $user_idenity”; }
else {
echo “Hello, Visitor”;
};
Can you please help in doing so.
]]>I built my first website quite recently and will be building another fairly soon. My question is:
Is there a way to have a user login page where users can create a profile and from this profile a small segment gets automatically pulled onto the main website in the form of a picture thumbnail and user name? With the this thumbnail, the link takes it to their full profile they created?
Being fairly new to website design and WordPress, what is involved in this type of design? What do I require? Widgets, themes, code, etc?
Regards,
James
]]>The modal pops up a php file with an html form and some javascript in it. I’d like to use wp_dropdown_categories() inside of the form instead of having a text input for cats.
Here’s a snippet. I have the original textbox I was using for category commented out and I was trying to stick that wp function in instead but it’s not working. WHat am I missing here? I can’t figure out if there’s something I need to be calling like a class or some global variable.
<?php
?>
<head>
<title>Box Shortcode</title>
...Some more html and some js...
<input type="radio" name="tax" value="category" id="selcat">
<?php wp_dropdown_categories(); ?> //This doesn't work
<!--<div class="input-append">
<input type="text" name="category" id="catselection" class="categorynamebox" placeholder="Category" value="" disabled="disabled" />
</div>-->
<label for="randomcat">
<input type="checkbox" id="randomcat" disabled="disabled" >
Use a random category
</label>
..some more html and js...
</body>
<?php
?>
]]>I want to add a site titled “Blog” so that I can run a custom theme under the permalink yagershots/blog. Unfortunately, when I go to “Add New” while logged in as Network Admin, it says “The following words are reserved for use by WordPress functions and cannot be used as blog names: page, comments, blog, files, feed”
Is there any option to change this?
Thank you!
]]>