javascript - Call function from WordPress function.php to page-home.php -


i'm stuck @ this. please help. basically, i'm trying create hover on image reveal social icons effect. clicking social icon take relevant page of social website in new window. got hover work except onclick not opening @ all.

my main social icon function in functions.php follows:

    function tfd_social_buttons($content) { global $post; $permalink = get_permalink($post->id); $title = get_the_title(); if(!is_feed() && !is_home() && !is_page()) {     $content = $content . '<div class="tfd-social-buttons"> <h5>share on</h5>      <a class="icon-twitter" href="http://twitter.com/share?text='.$title.'& url='.$permalink.'"         onclick="window.open(this.href, \'twitter-share\', \'width=550,height=235\');return false;">         <span>twitter</span>     </a>          <a class="icon-fb" href="https://www.facebook.com/sharer/sharer.php?u='.$permalink.'"          onclick="window.open(this.href, \'facebook-share\',\'width=580,height=296\');return false;">         <span>facebook</span>     </a>      <a class="icon-gplus" href="https://plus.google.com/share?url='.$permalink.'"        onclick="window.open(this.href, \'google-plus-share\', \'width=490,height=530\');return false;">         <span>google+</span>     </a> </div>'; } return $content;  }   add_filter('the_content', 'tfd_social_buttons');' 

this i'm trying implement on page-home.php

<!-- beginning of featured stories -->             <div id="freshly-pressed"> <?php global $post; $args = array( 'post_type' => 'post', 'posts_per_page' => -1 ); $myposts = get_posts( $args );  foreach( $myposts $post ) : setup_postdata($post); ?>              <div class="press">    <figure class="cap-bot">             <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('large', array('class' => 'featured-thumb grayscale')); ?></a>            <figcaption>       <div class="tfd-social-buttons"> <a class="icon-twitter" href="http://twitter.com/share?text='.$title.'& url='.$permalink.'"     onclick="window.open(this.href, \'twitter-share\', \'width=550,height=235\');return false;">     <span>twitter</span> </a>      <a class="icon-fb" href="https://www.facebook.com/sharer/sharer.php?u='.$permalink.'"      onclick="window.open(this.href, \'facebook-share\',\'width=580,height=296\');return false;">     <span>facebook</span> </a>  <a class="icon-gplus" href="https://plus.google.com/share?url='.$permalink.'"    onclick="window.open(this.href, \'google-plus-share\', \'width=490,height=530\');return false;">     <span>google+</span> </a> </div>  </figcaption>  </figure>                 <div class="press-info"> <h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>             <p><?php the_date(); ?></p><p><?php $content = get_the_content(); echo wp_trim_words( $content , '15' ); ?></p>             </div><!-- press-info -->               </div><!-- press -->        <?php endforeach; ?>              </div><!-- freshly pressed -->                <!-- end of featured stories --> 

the hover effect , icons visible onclick not open new window. there anyway can call function upon onclick functions.php. appreciated thanks.

wordpress stops lines of code security reasons, , problem doesn't inform you. try using plugin insert code in post, when install plugin put code between [script] , [/script]


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -