I would like to add thickbox for the template which I develop to WordPress. At this time I’m trying with a clean template that have only header.php
, footer.php
,index.php
, and functions.php
.
I’ve included the <?php wp_head(); ?>
into header.php
and the <?php wp_footer(); ?>
into footer.php
.
I’ve included the wp_head
like this:
<?php
wp_enqueue_script('jquery');
wp_enqueue_script('thickbox');
wp_enqueue_style('thickbox');
wp_head();
?>
I’ve changed the gallery link classes to thickbox with this code in functions.php
<?php add_filter( 'wp_get_attachment_link', 'sant_prettyadd');
function sant_prettyadd ($content) {
$content = preg_replace("/<a/","<a class="thickbox[slides]"",$content,1);
return $content;
}
?>
When I’m clicking on to a gallery image it should open with thickbox but it opens the imagefile only.
You need to use the wp_enqueue_script function (in your functions.php file) to call the relevant scripts you need. It allows for both built-in libraries and to add any custom that you’re including in your theme.
All you need to do is a simple call in your
functions.php
:Thatâs it. WordPress will now enqueue jQuery and the thickbox script. By default, linked images arenât thickboxy yet. You need to:
thickbox
to the links manually/per PHP, orSample code for
footer.php
:This code adds the class
thickbox
to all links around medium sized images, and it groups these links to enable the next/prev navigation links.Now you get a basic thickbox with translated navigation links:
Since this is a script managed by the core it is not keyboard user friendly: The arrow keys donât do anything. If you need a more usable solution â take a plugin.
Another note: Thickbox may be removed sooner or later from the core. See Ticket 10955.
Hi can any one help me to resolve my problem::
Here it my code
this piece of code i’m trying to use in Wp-admin profile it is working fine but.. there is a problem… i.e while I try to chance the user avatar from front end TB_ifram is not popping up… it is spreading to whole webpage…
here it’s image:
here i need to popup the TB_Ifram content frame from the front end… plz give me suggestion that would be great to you..
regards