Remove html elements from wordpress plugin - php

I am trying to remove the default divs that are wrapped around with the Wordpress Social Login plugin.
This is what is output by default:
<div class="wp-social-login-widget">
<div class="wp-social-login-connect-with">{connect_with_caption}</div>
<div class="wp-social-login-provider-list">
<a class="wp-social-login-provider wp-social-login-provider-facebook">
<img src="{provider_icon_facebook}" />
</a>
<a class="wp-social-login-provider wp-social-login-provider-google">
<img src="{provider_icon_google}" />
</a>
<a class="wp-social-login-provider wp-social-login-provider-twitter">
<img src="{provider_icon_twitter}" />
</a>
</div> <!-- / div.wp-social-login-connect-options -->
<div class="wp-social-login-widget-clearing"></div>
</div> <!-- / div.wp-social-login-widget -->
I'd like to get rid of all the divs and classes associated with the anchors. So that I can style it using my own theme.
I have found the file that generates those tags - but don't want to directly edit the plugin file wsl.auth.widgets.php because when it's updated then I'll have to continuously change it, removing with css display:none; might be an option but I would prefer writing something in the functions.php file so that it's permanent.
I've seen this function which changes the anchors only not sure how to go about removing the divs as well.
function wsl_use_fontawesome_icons( $provider_id, $provider_name, $authenticate_url )
{
?>
<a
rel = "nofollow"
href = "<?php echo $authenticate_url; ?>"
data-provider = "<?php echo $provider_id ?>"
class = "wp-social-login-provider wp-social-login-provider-<?php echo strtolower( $provider_id ); ?>"
>
<span>
<i class="fa fa-<?php echo strtolower( $provider_id ); ?>"></i>
Sign in with <?php echo $provider_name; ?>
</span>
</a>
<?php
}
add_filter( 'wsl_render_auth_widget_alter_provider_icon_markup', 'wsl_use_fontawesome_icons', 10, 3 );
Any help would be appreciated, thanks.

Related

LightBox plugin not working php jquery

I have following html in which I am using LightBox plugin by Lokesh Dhakar. I am getting images dynamically from database and done all required things to carry out with plugin, but still not working. Only the empty lightbox window appears when page loads.
Here is my code:
while ($fetch = mysql_fetch_array($selectImgResult)) { ?>
<div class="col-md-2 thumbnail">
<span style="color:slateblue;">
<?php echo $fetch['CreateDate']; ?>
</span>
<a href="ProfilePic\<?php echo $fetch['ImageUrl'];?>" data-lightbox="images">
<img src="ProfilePic\<?php echo $fetch['ImageUrl']; ?>" alt="<?php echo $fetch['ImageUrl']; ?>" style="height: 178px;" />
</a>
</div>
<?php }

How to get URL from specific <img src=> and put into <a href=> for use with Lightbox

I have built a site for someone else who will be updating it via a CMS (CushyCMS). They wanted a lightbox gallery included. I want to be able to allow them to upload a new image and for that image url to be copied into the a tag so lightbox works.
So far I am able to do that, but the client has to ensure the file names and format are exactly the same as what I have set them to in the php code. Is there a way to get the img url from the img tag (possibly identifying it using an id attribute) and put it directly into the tag?
Heres what I have so far:
<?php
$src1 = "images/test1.jpg";
$src2 = "images/test2.jpg";
?>
<a href="<?php echo $src1?>" data-lightbox="group-1">
<img class="cushycms profile" name="image1" id="slideshow_image" src="images/test1.jpg"/></a>
<a href="<?php echo $src2?>" data-lightbox="group-1">
<img class="cushycms profile" id="slideshow_image" src="images/test2.jpg"/></a>
Many thanks!
You can do it with jQuery:
<a data-lightbox="group-1">
<img name="image1" src="images/test1.jpg" />
</a>
<script>
var img = $('img[name="image1"]');
var imgSrc = img.attr('src');
img.parent().attr('href', imgSrc);
</script>
If you have multiple images and want to automate this you can use the map function:
<a data-lightbox="group-1">
<img name="image1" src="images/test1.jpg" class="slideshow" />
</a>
<a data-lightbox="group-1">
<img name="image2" src="images/test2.jpg" class="slideshow" />
</a>
<a data-lightbox="group-1">
<img name="image3" src="images/test3.jpg" class="slideshow" />
</a>
<script>
$(".slideshow").map(function() {
$(this).parent().attr('href', this.src);
});
</script>
Assuming you use jQuery somewhere there, you could/should use a lightbox plugin, like this one here:
http://www.jacklmoore.com/colorbox/
Using the xamples there, you would then use:
(http://www.jacklmoore.com/colorbox/example1/)
$('a.gallery').colorbox({rel:'group-1'});
which would result in a lighbox gallery showing on "click" on any anchor with class "gallery" while the gallery would show all the elements pointed by "href" from all anchors of that have class="group-1" (so each anchor would be
although you have to include some files for jquery and the lightbox plugin, I think it will make your life much easier in the end.
Also not sure what your php level is, but the example code you have there asks for:
<?php
$images = array(
'images/test1.jpg',
'images/test2.jpg'
);
?>
<?php foreach($images as $i => $url): ?>
<a href="<?php echo $url?>" data-lightbox="group-1">
<img class="cushycms profile" name="image<?php echo $i+1 ?>" id="slideshow_image" src="<?php echo $url ?>"/>
</a>
<?php endforeach; ?>
Just in case you got more images there.

wordpress nextgen gallery stray </p>

Hello i am updating a WordPress site that was riddled with errors (over 1000...-'-) now i have gotten it down to 15 or so however one page has 105 errors and they are all caused by a stray p tag that is being generated after every image here's what the code is being outputted as
<div id="ngg-image-40" class="ngg-gallery-thumbnail-box" >
<div class="ngg-gallery-thumbnail" >
<a href="a link" title="the title" class="shutterset_set_5" ><br />
<img title="01596-01_1" alt="01596-01_1" src="the src" width="100" height="75" /><br />
</a>
</div>
</p></div>
As you can see there is a p tag there for no reason, I've tried Google but got no one with a solution to this problem, I've tried looking through all the php files for the nextgen gallery and couldn't figure it out the actual code that outputs the gallery is below.
<div id="ngg-image-<?php echo $image->pid ?>" class="ngg-gallery-thumbnail-box" <?php echo $image->style ?> >
<div class="ngg-gallery-thumbnail" >
<a href="<?php echo $image->imageURL ?>" title="<?php echo $image->description ?>" <?php echo $image->thumbcode ?> >
<?php if ( !$image->hidden ) { ?>
<img title="<?php echo $image->alttext ?>" alt="<?php echo $image->alttext ?>" src="<?php echo $image->thumbnailURL ?>" <?php echo $image->size ?> />
<?php } ?>
</a>
</div>
</div>
Again as you can see there is no reference to the p tag in the above. Any and all help is appreciated.
I also did not find a solution within the gallery but I have to admit that I didn't search that well. I was lazy and fixed it with javascript as I use a custom javascript for my gallery. Maybe that helps you, too. It's MooTools btw. and assumes that the gallery div has the id "gallery":
var p = document.id('gallery').getPrevious();
if (p.get('tag') == 'p') {
p.dispose();
}

How to make a specific loop for this function that gets the posts?

I am doing some WordPress theming. I have a #novelsslider div. Inside of #novels, I used this code to get the latest three posts in the "novels" category, inside of the html divs, I used some php functions to get the latest 3 posts and load the html 3 times floated to the left to build a slider:
<!-- slider -->
<div id="novelsslider" class="slider">
<? $novels = get_option('of_novels') ?>
<?php query_posts('category_name=$novels&posts_per_page=3'); ?>
<?php while (have_posts()) : the_post(); ?>
<div class="sliderunit">
<?php the_post_thumbnail(); ?>
<div class="novelsslidertitle">
<div class="arrow-left"></div>
<a href="<?php the_permalink(); ?>">
<img class="cross" src="<?php bloginfo('stylesheet_directory'); ?>/images/cross.png"/>
</a>
<a href="<?php the_permalink(); ?>">
<?php the_title(); ?>
</a>
</div>
</div>
<?php endwhile;?>
<div id="novelsslidebars">
<input type="submit" value="" class="slidebars" id="novelsslidebtnleft">
<input type="submit" value="" class="slidebars" id="novelsslidebtnmiddle">
<input type="submit" value="" class="slidebars" id="novelsslidebtnright">
</div>
</div>
<!-- End novelsslider -->
ow I have some arrows.. I want them when clicked to get a set of previous 3 posts and load them, how can I do such a loop?
To achieve this you can adopt any of these methods :
1- If your posts are not in large number then you can preload them and store in some container which is hidden by default and will appear when you click the next / previous button, like a content slider, but this is a bad approach and not recommended.
2- Use AJAX to load the rest of the posts, this is a good method and will be purely dynamic. Look on the following links to have the idea:
http://wp.tutsplus.com/tutorials/getting-loopy-ajax-powered-loops-with-jquery-and-wordpress/
Wordpress - how can I fetch more posts via AJAX?

Display Terms of service in any place (Joomla/Virtuemart 2.x)

I have some toruble with displaying terms of service.
At the cart page all works fine: http://mtxt.ibroken.ru/component/virtuemart/cart.html?Itemid=0
(bottom link) opens popup with text, generated by
<?php echo $this->cart->vendor->vendor_terms_of_service; ?>
code.
But i have button on the shop page http://mtxt.ibroken.ru/magazin.html (top button at right side), which must display same text...
At present moment text written in /modules/mod_virtuemart_cart/tmpl/default.php file. But how to get it in this file from shop interface by using PHP?
pps. Ugly English, sorry for that :)
You need to modify /modules/mod_virtuemart_cart/tmpl/default.php (or your override) and add this code just after line 3:
vmJsApi::js ('facebox');
vmJsApi::css ('facebox');
$document = JFactory::getDocument ();
$document->addScriptDeclaration ("
jQuery(document).ready(function($) {
$('div#full-tos').hide();
$('a#terms-of-service').click(function(event) {
event.preventDefault();
$.facebox( { div: '#full-tos' }, 'my-groovy-style');
});
});
");
And add this code just after line 53
<div class="show_cart">
<?php
if(!class_exists('VirtueMartModelVendor'))
require(JPATH_VM_ADMINISTRATOR.DS.'models'.DS.'vendor.php');
$vendor = VmModel::getModel('vendor');
$vendor = $vendor->getVendor();
?>
<br />
<span style="z-index: 0;">
<a href="<?php JRoute::_ ('index.php?option=com_virtuemart&view=vendor&layout=tos&virtuemart_vendor_id=1') ?>" class="terms-of-service" id="terms-of-service" rel="facebox" target="_blank">
<?php echo JText::_ ('COM_VIRTUEMART_CART_TOS_READ_AND_ACCEPTED'); ?>
</a>
</span>
<div id="full-tos">
<h2><?php echo JText::_ ('COM_VIRTUEMART_CART_TOS'); ?></h2>
<?php echo $vendor->vendor_terms_of_service; ?>
</div>
</div>
That shoud do the trick!

Categories