Title: Insert code before TOX
Last modified: April 8, 2024

---

# Insert code before TOX

 *  Resolved [cionfs](https://wordpress.org/support/users/cionfs/)
 * (@cionfs)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/insert-code-before-tox/)
 * Hi,
 * I need to add a code (social share) before the toc. 
   Actually I have created 
   this code
 *     ```wp-block-code
       add_action('the_content', 'inserisci_pulsanti_condivisione_sopra_titolo');
   
       function inserisci_pulsanti_condivisione_sopra_titolo($content) {
           // Verifica se l'elemento corrente è un articolo singolo
           if (is_single()) {
               // URL dell'articolo corrente
               $link = get_permalink();
   
               // Costruisci i pulsanti di condivisione
               $pulsanti_condivisione = '<div class="pulsanti-condivisione">';
               $pulsanti_condivisione .= '<p>Condividi questo articolo:</p>';
               $pulsanti_condivisione .= '<ul class="pulsanti-social">';
               $pulsanti_condivisione .= '<li><a href="https://www.facebook.com/sharer/sharer.php?u=' . $link . '" target="_blank"><img src="url_image" alt="Condividi su Facebook"></a></li>';
               $pulsanti_condivisione .= '<li><a href="https://twitter.com/intent/tweet?url=' . $link . '" target="_blank"><img src="url_image" alt="Condividi su Twitter"></a></li>';
               $pulsanti_condivisione .= '<li><a href="https://api.whatsapp.com/send?text=' . $link . '" target="_blank"><img src="url_image" alt="Condividi su WhatsApp"></a></li>';
               $pulsanti_condivisione .= '<li><a href="https://t.me/share/url?url=' . $link . '" target="_blank"><img src="url_image" alt="Condividi su Telegram"></a></li>';
               $pulsanti_condivisione .= '<li><a href="https://www.linkedin.com/shareArticle?url=' . $link . '" target="_blank"><img src="url_image" alt="Condividi su LinkedIn"></a></li>';
               $pulsanti_condivisione .= '<li><a href="https://threads.net/intent/post?text=' . $link . '" target="_blank"><img src="url_image" alt="Condividi su Threads"></a></li>';
               $pulsanti_condivisione .= '</ul>';
               $pulsanti_condivisione .= '</div>';
   
               // Inserisci i pulsanti di condivisione sopra il titolo dell'articolo
               $content = $pulsanti_condivisione . $content;
           }
   
           return $content;
       }
       ```
   
 * but the results is this
 * ![](https://i0.wp.com/i.ibb.co/xDZK3tM/socials.jpg?ssl=1)
 * I need to add this before the TOC like this
 * ![](https://i0.wp.com/i.ibb.co/555hS6t/socials2.jpg?ssl=1)
 * what is the variable for the TOC?

Viewing 1 replies (of 1 total)

 *  Plugin Author [Magazine3](https://wordpress.org/support/users/magazine3/)
 * (@magazine3)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/insert-code-before-tox/#post-17561666)
 * Hi, thank you for reaching out to us. You can go to the main PHP file. Inside,
   you will find the **‘function the_content’**. Here is the path: **wp-content\
   plugins\Easy-Table-of-Contents\easy-table-of-contents.php** where you can see
   the file. Inside there is code, and you can make changes accordingly.

Viewing 1 replies (of 1 total)

The topic ‘Insert code before TOX’ is closed to new replies.

 * ![](https://ps.w.org/easy-table-of-contents/assets/icon-256x256.png?rev=3045459)
 * [Easy Table of Contents](https://wordpress.org/plugins/easy-table-of-contents/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/easy-table-of-contents/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/easy-table-of-contents/)
 * [Active Topics](https://wordpress.org/support/plugin/easy-table-of-contents/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/easy-table-of-contents/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/easy-table-of-contents/reviews/)

## Tags

 * [social](https://wordpress.org/support/topic-tag/social/)
 * [variable](https://wordpress.org/support/topic-tag/variable/)

 * 1 reply
 * 2 participants
 * Last reply from: [Magazine3](https://wordpress.org/support/users/magazine3/)
 * Last activity: [2 years, 1 month ago](https://wordpress.org/support/topic/insert-code-before-tox/#post-17561666)
 * Status: resolved