Tooltip with title and featured image Wordpress function - wordpress

I want to code a function to get a popup or tooltip which shows the featured image and the title of an internal link when you hover a link on a post or page.
Does anybody know if this is possible and knows how? I know you have to use some filter hook of Wordpress and to use get_post_field('post_title') and $image = get_the_post_thumbnail_url().
I think it can only be done with a function that has to be put in the functions.php.

Related

How to force WordPress Gutenberg to update the featured image after saving the post?

I am working on a plugin that automatically attaches a featured image to a WordPress post after save (i.e. programmatically not using the Media Selector). The plugin uses the add_action( 'save_post_post', 'myFunction'); hook to save the image to the post.
The Gutenberg UI does not update the featured image thumbnail in the metabox on the right column.
I have tested and verified that the image is successfully updated and attached to the post, and does show if you manually reload the page.
From what I can tell, I need to tell Gutenberg the featured image has been changed in order for it to be updated in the view.
I have been unable to locate a hook or action I can use to trigger such a refresh after the user presses the "Save" button.
What is the appropriate way accomplish this refresh (from within my plugin PHP file)?
The way I see it, WordPress takes care of the update for you. Maybe you didn't use the right hook?
When I use the following, my posts have a default thumbnail, whenever I open a new plugin page:
function custom_add_thumbnail( $post_ID ) {
set_post_thumbnail($post_ID, 67);
return $post_ID;
}
add_action( 'save_post', 'custom_add_thumbnail' );
If this doesn't help, please share your code, maybe in pastebin, so I can investigate further.

Woocommerce add click to enlarge under featured image

I'm using Woocomerce (Wootique) and I'd like to add "Click To Enlarge Image" beneath the featured image on single product page. Text should show beneath image and above the description/reviews tabs.
Can't figure it out? Any ideas?
http://www.forgottentreasurez.us/product/hand-signed-limited-edition-serigraph-mazal-tov-love/
Thank you in advance
There’s an action that you can use to add content below featured images, which can be used before or after product thumbnails. The woocommerce_product_thumbnail action is what will help us out. Let’s add a notice that says, “Click to Enlarge” below the featured image.
We’ll use a function to insert this text as a heading below the featured image. You can add this to your child theme or, even better, a code snippet using the Code Snippet plugin.
function skyverge_add_below_featured_image() {
echo '<h4 style="text-align:center;margin-top:10px;">Click to Enlarge</h4>';
}
add_action( 'woocommerce_product_thumbnails' , 'skyverge_add_below_featured_image', 9 );

call a function when we click on the post title

On the front page of my testing WordPress site I have 10 posts. When we click on the post title or post featured image, it takes us to that particular post .
I want to call a function on my plugin, when we click title or image.
Is there any add_action() for that ? or suggest me how can we achieve the result.
You can try overriding the function "get_permalink".
It can be found in the following file-
http://core.trac.wordpress.org/browser/tags/3.5.1/wp-includes/link-template.php

Setting thumbnail featured image size not working properly

Hi I just started today on creating my first Wordpress Theme and I am trying to create a featured Image for each post.Aldo I have managed to acomplish that it seems that the sizes I am giving it are not taking effect.Here is my code:
if(function_exists('add_theme_support')){
add_theme_support('post-thumbnails' , array('post'));
set_post_thumbnail_size(200,120);
}
if(function_exists('has_post_thumbnail') && has_post_thumbnail()){
the_post_thumbnail();
}
It seems that my featured images are not always set to the same size.For example if the image is smaller then what size I set it will remain the same , for big images the width is the same but for some the height is different.
What am I doing wrong here?
Are you setting the thumbnail size in functions.php? It will not work properly if it's just in index.php or another theme file.
From the codex:
This feature must be called before the init hook is fired. That means
it needs to be placed directly into functions.php or within a function
attached to the 'after_setup_theme' hook. For custom post types, you
can also add post thumbnails using the register_post_type function as
well.
the_post_thumbnail() displays the thumbnail and should be placed where you want the thumbnail to display.

Wordpress set title?

I have a wordpress website which I've added a couple of custom pages to. Everything works fine except that those custom pages don't have titles. Is there a (short?) way to add titles to those custom pages?
Edit: I think I was unclear, I meant the title at the top of the browser (html title) not the title of a wordpress page.
You can go to the 'Pages' page where it lists the pages and use quick edit:
Hover over a page and click 'Quick Edit'
Make your changes, and then click 'Update'.
EDIT
I seem to have misunderstood the question. Yes, WordPress gives you a filter to play with the title. See below:
function my_title_tag_filterer( $title, $separator, $separator_location ){
//You can do things to the title here.
return $title;
}
add_filter( 'wp_filter', 'my_title_tag_filterer' );
$title is the title, $separator is the text that goes between the blog title and the page title, and $separator_location is where the separator goes in relation to the page title.

Resources