I'm making a plugin to add image at bottom right corner of every page. Followin is the code which is functioning correct and add image as content.
add_filter('the_content', 'scroll_to_top_data');
but I want to add it after footer on bottom right corner for which I tried:
add_action('wp_footer', 'scroll_to_top_data');
but this is not displaying image anywhere also no error is displayed. I'm using twentyfifteen theme but of course I want this plugin to be usable on all theme of wordpress. Please guide me why it's not working with wp_footer hook and how can I put this on after footer? Below is the scroll_to_top_data function
function scroll_to_top_data($content = NULL) {
$post_id = get_the_ID();
global $wpdb;
$table = $wpdb->prefix . 'scroll';
$myrows = $wpdb->get_results("SELECT * FROM $table WHERE id = 1");
$beforeafter = $myrows[0]->beforeafter;
$where_like = $myrows[0]->where_like;
$status = $myrows[0]->status;
$image = $myrows[0]->image;
$action = $myrows[0]->action;
$color = $myrows[0]->color;
$display = $myrows[0]->display;
$except_ids = $myrows[0]->except_ids;
$url = $myrows[0]->url;
$width = $myrows[0]->width;
$position = $myrows[0]->position;
$str = $image;
if ($status != 0) {
$scrollImage = '<img src="' . $image . '"';
return $content . $scrollImage;
} else {
return $content;
}
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire