Skip to main content
replaced http://wordpress.stackexchange.com/ with https://wordpress.stackexchange.com/
Source Link

I actually link to the wrong post although this postthis post should still help you. The actual post I wanted to link to was this onethis one

You should use this second link as a guide as there are some issues with your code, although not major. The biggest concern here is your repetition of code

To get back to what you actually need, you have to remove the filter and all instances of $content which is passed by reference to the the_content filter.

You can simply modify your existing code to the following

function social_buttons() {
    global $post;
    $permalink = get_permalink($post->ID);
    $title = get_the_title();
    if(!is_single() && !is_page()) { ?>
        <div class="contentBottom">
        <ul class="share">
            <li><a href="#"><i class="fa fa-share-alt"></i>شارك</a>
                <ul class="social">
                   <li><a href="https://www.facebook.com/sharer/sharer.php?u='.$permalink.'"
             onclick="window.open(this.href, \'facebook-share\',\'width=580,height=296\');return false;"><i class="fa fa-facebook"></i></a></li>
                   <li><a href="http://twitter.com/share?text='.$title.'&url='.$permalink.'"
            onclick="window.open(this.href, \'twitter-share\', \'width=550,height=235\');return false;"><i class="fa fa-twitter"></i></a></li>
                   <li><a href="https://plus.google.com/share?url='.$permalink.'"
           onclick="window.open(this.href, \'google-plus-share\', \'width=490,height=530\');return false;"><i class="fa fa-google-plus"></i></a></li>
                   <li><a href="#"><i class="fa fa-envelope"></i></a></li>
               </ul>
           </li>
        </ul>
        <ul class="printComment">
            <li><a href="javascript:window.print()" rel="nofollow"><i class="fa fa-print"></i>طباعة</a></li>
            <li><a href="#"><i class="fa fa-comments-o"></i>شارك بالتعليق</a></li>
        </ul></div>
    <?php 
}
}

You can now call the function where you like as follows

social_buttons();

I actually link to the wrong post although this post should still help you. The actual post I wanted to link to was this one

You should use this second link as a guide as there are some issues with your code, although not major. The biggest concern here is your repetition of code

To get back to what you actually need, you have to remove the filter and all instances of $content which is passed by reference to the the_content filter.

You can simply modify your existing code to the following

function social_buttons() {
    global $post;
    $permalink = get_permalink($post->ID);
    $title = get_the_title();
    if(!is_single() && !is_page()) { ?>
        <div class="contentBottom">
        <ul class="share">
            <li><a href="#"><i class="fa fa-share-alt"></i>شارك</a>
                <ul class="social">
                   <li><a href="https://www.facebook.com/sharer/sharer.php?u='.$permalink.'"
             onclick="window.open(this.href, \'facebook-share\',\'width=580,height=296\');return false;"><i class="fa fa-facebook"></i></a></li>
                   <li><a href="http://twitter.com/share?text='.$title.'&url='.$permalink.'"
            onclick="window.open(this.href, \'twitter-share\', \'width=550,height=235\');return false;"><i class="fa fa-twitter"></i></a></li>
                   <li><a href="https://plus.google.com/share?url='.$permalink.'"
           onclick="window.open(this.href, \'google-plus-share\', \'width=490,height=530\');return false;"><i class="fa fa-google-plus"></i></a></li>
                   <li><a href="#"><i class="fa fa-envelope"></i></a></li>
               </ul>
           </li>
        </ul>
        <ul class="printComment">
            <li><a href="javascript:window.print()" rel="nofollow"><i class="fa fa-print"></i>طباعة</a></li>
            <li><a href="#"><i class="fa fa-comments-o"></i>شارك بالتعليق</a></li>
        </ul></div>
    <?php 
}
}

You can now call the function where you like as follows

social_buttons();

I actually link to the wrong post although this post should still help you. The actual post I wanted to link to was this one

You should use this second link as a guide as there are some issues with your code, although not major. The biggest concern here is your repetition of code

To get back to what you actually need, you have to remove the filter and all instances of $content which is passed by reference to the the_content filter.

You can simply modify your existing code to the following

function social_buttons() {
    global $post;
    $permalink = get_permalink($post->ID);
    $title = get_the_title();
    if(!is_single() && !is_page()) { ?>
        <div class="contentBottom">
        <ul class="share">
            <li><a href="#"><i class="fa fa-share-alt"></i>شارك</a>
                <ul class="social">
                   <li><a href="https://www.facebook.com/sharer/sharer.php?u='.$permalink.'"
             onclick="window.open(this.href, \'facebook-share\',\'width=580,height=296\');return false;"><i class="fa fa-facebook"></i></a></li>
                   <li><a href="http://twitter.com/share?text='.$title.'&url='.$permalink.'"
            onclick="window.open(this.href, \'twitter-share\', \'width=550,height=235\');return false;"><i class="fa fa-twitter"></i></a></li>
                   <li><a href="https://plus.google.com/share?url='.$permalink.'"
           onclick="window.open(this.href, \'google-plus-share\', \'width=490,height=530\');return false;"><i class="fa fa-google-plus"></i></a></li>
                   <li><a href="#"><i class="fa fa-envelope"></i></a></li>
               </ul>
           </li>
        </ul>
        <ul class="printComment">
            <li><a href="javascript:window.print()" rel="nofollow"><i class="fa fa-print"></i>طباعة</a></li>
            <li><a href="#"><i class="fa fa-comments-o"></i>شارك بالتعليق</a></li>
        </ul></div>
    <?php 
}
}

You can now call the function where you like as follows

social_buttons();
added 7 characters in body
Source Link
Pieter Goosen
  • 55.4k
  • 23
  • 115
  • 209

I actually link to the wrong post although this post should still help you. The actual post I wanted to link to was this one

You should use this second link as a guide as there are some issues with your code, although not major. The biggest concern here is your repetition of code

To get back to what you actually need, you have to remove the filter and all instances of $content which is passed by reference to the the_content filter.

You can simply modify your existing code to the following

function social_buttons() {
    global $post;
    $permalink = get_permalink($post->ID);
    $title = get_the_title();
    if(!is_single() && !is_page()) { ?>
        <div class="contentBottom">
        <ul class="share">
            <li><a href="#"><i class="fa fa-share-alt"></i>شارك</a>
                <ul class="social">
                   <li><a href="https://www.facebook.com/sharer/sharer.php?u='.$permalink.'"
             onclick="window.open(this.href, \'facebook-share\',\'width=580,height=296\');return false;"><i class="fa fa-facebook"></i></a></li>
                   <li><a href="http://twitter.com/share?text='.$title.'&url='.$permalink.'"
            onclick="window.open(this.href, \'twitter-share\', \'width=550,height=235\');return false;"><i class="fa fa-twitter"></i></a></li>
                   <li><a href="https://plus.google.com/share?url='.$permalink.'"
           onclick="window.open(this.href, \'google-plus-share\', \'width=490,height=530\');return false;"><i class="fa fa-google-plus"></i></a></li>
                   <li><a href="#"><i class="fa fa-envelope"></i></a></li>
               </ul>
           </li>
        </ul>
        <ul class="printComment">
            <li><a href="javascript:window.print()" rel="nofollow"><i class="fa fa-print"></i>طباعة</a></li>
            <li><a href="#"><i class="fa fa-comments-o"></i>شارك بالتعليق</a></li>
        </ul></div>
    <?php 
}
}

You can now call the function where you like as follows

social_buttons();

I actually link to the wrong post although this post should still help you. The actual post I wanted to link to was this one

You should use this second link as a guide as there are some issues with your code, although not major. The biggest concern here is your repetition of code

To get back to what you actually need, you have to remove the filter and all instances of $content which is passed by reference to the the_content filter.

You can simply modify your existing code to the following

function social_buttons() {
    global $post;
    $permalink = get_permalink($post->ID);
    $title = get_the_title();
    if(!is_single() && !is_page()) { ?>
        <div class="contentBottom">
        <ul class="share">
            <li><a href="#"><i class="fa fa-share-alt"></i>شارك</a>
                <ul class="social">
                   <li><a href="https://www.facebook.com/sharer/sharer.php?u='.$permalink.'"
             onclick="window.open(this.href, \'facebook-share\',\'width=580,height=296\');return false;"><i class="fa fa-facebook"></i></a></li>
                   <li><a href="http://twitter.com/share?text='.$title.'&url='.$permalink.'"
            onclick="window.open(this.href, \'twitter-share\', \'width=550,height=235\');return false;"><i class="fa fa-twitter"></i></a></li>
                   <li><a href="https://plus.google.com/share?url='.$permalink.'"
           onclick="window.open(this.href, \'google-plus-share\', \'width=490,height=530\');return false;"><i class="fa fa-google-plus"></i></a></li>
                   <li><a href="#"><i class="fa fa-envelope"></i></a></li>
               </ul>
           </li>
        </ul>
        <ul class="printComment">
            <li><a href="javascript:window.print()" rel="nofollow"><i class="fa fa-print"></i>طباعة</a></li>
            <li><a href="#"><i class="fa fa-comments-o"></i>شارك بالتعليق</a></li>
        </ul></div>
    <?php 
}

You can now call the function where you like as follows

social_buttons();

I actually link to the wrong post although this post should still help you. The actual post I wanted to link to was this one

You should use this second link as a guide as there are some issues with your code, although not major. The biggest concern here is your repetition of code

To get back to what you actually need, you have to remove the filter and all instances of $content which is passed by reference to the the_content filter.

You can simply modify your existing code to the following

function social_buttons() {
    global $post;
    $permalink = get_permalink($post->ID);
    $title = get_the_title();
    if(!is_single() && !is_page()) { ?>
        <div class="contentBottom">
        <ul class="share">
            <li><a href="#"><i class="fa fa-share-alt"></i>شارك</a>
                <ul class="social">
                   <li><a href="https://www.facebook.com/sharer/sharer.php?u='.$permalink.'"
             onclick="window.open(this.href, \'facebook-share\',\'width=580,height=296\');return false;"><i class="fa fa-facebook"></i></a></li>
                   <li><a href="http://twitter.com/share?text='.$title.'&url='.$permalink.'"
            onclick="window.open(this.href, \'twitter-share\', \'width=550,height=235\');return false;"><i class="fa fa-twitter"></i></a></li>
                   <li><a href="https://plus.google.com/share?url='.$permalink.'"
           onclick="window.open(this.href, \'google-plus-share\', \'width=490,height=530\');return false;"><i class="fa fa-google-plus"></i></a></li>
                   <li><a href="#"><i class="fa fa-envelope"></i></a></li>
               </ul>
           </li>
        </ul>
        <ul class="printComment">
            <li><a href="javascript:window.print()" rel="nofollow"><i class="fa fa-print"></i>طباعة</a></li>
            <li><a href="#"><i class="fa fa-comments-o"></i>شارك بالتعليق</a></li>
        </ul></div>
    <?php 
}
}

You can now call the function where you like as follows

social_buttons();
Source Link
Pieter Goosen
  • 55.4k
  • 23
  • 115
  • 209

I actually link to the wrong post although this post should still help you. The actual post I wanted to link to was this one

You should use this second link as a guide as there are some issues with your code, although not major. The biggest concern here is your repetition of code

To get back to what you actually need, you have to remove the filter and all instances of $content which is passed by reference to the the_content filter.

You can simply modify your existing code to the following

function social_buttons() {
    global $post;
    $permalink = get_permalink($post->ID);
    $title = get_the_title();
    if(!is_single() && !is_page()) { ?>
        <div class="contentBottom">
        <ul class="share">
            <li><a href="#"><i class="fa fa-share-alt"></i>شارك</a>
                <ul class="social">
                   <li><a href="https://www.facebook.com/sharer/sharer.php?u='.$permalink.'"
             onclick="window.open(this.href, \'facebook-share\',\'width=580,height=296\');return false;"><i class="fa fa-facebook"></i></a></li>
                   <li><a href="http://twitter.com/share?text='.$title.'&url='.$permalink.'"
            onclick="window.open(this.href, \'twitter-share\', \'width=550,height=235\');return false;"><i class="fa fa-twitter"></i></a></li>
                   <li><a href="https://plus.google.com/share?url='.$permalink.'"
           onclick="window.open(this.href, \'google-plus-share\', \'width=490,height=530\');return false;"><i class="fa fa-google-plus"></i></a></li>
                   <li><a href="#"><i class="fa fa-envelope"></i></a></li>
               </ul>
           </li>
        </ul>
        <ul class="printComment">
            <li><a href="javascript:window.print()" rel="nofollow"><i class="fa fa-print"></i>طباعة</a></li>
            <li><a href="#"><i class="fa fa-comments-o"></i>شارك بالتعليق</a></li>
        </ul></div>
    <?php 
}

You can now call the function where you like as follows

social_buttons();