Title: Shortcode in footer.php solution
Last modified: December 30, 2021

---

# Shortcode in footer.php solution

 *  [semplicewebsite](https://wordpress.org/support/users/semplicewebsite/)
 * (@semplicewebsite)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/shortcode-in-footer-php-solution/)
 * Hi everyone. I thought I’d share this solution to allow you to insert the button
   to withdraw consent directly in the footer and make it appear elegantly on the
   left at the bottom.
 * First, for the shortcode to work, you need to put this code in function.php
 *     ```
       add_filter('widget_text', 'shortcode_unautop');
        add_filter('widget_text', 'do_shortcode');
       ```
   
 * Then in the footer.php file, obviously of the child theme, you need to insert
   this before the `<?php wp_footer(); ?>` tag
 *     ```
       <div>
       	<?php
       	echo do_shortcode('[revoke_cookie_consent]')
       		?>
       </div>
   
       <style>
       .cookie-notice-consent__revoke-button {
   
       		background-color:#212121;
       		background-image:none;
       		color:#fff;
       		text-shadow:none;
       		font-weight:bold;
       		transition:.2s;
       		position:fixed;
       		padding:5px 15px;
       		bottom:0;
       		height:auto;
       		width:auto;
       		left:5%;
       		z-index:99999999;
       		box-shadow:0 0 10px #000;
       		border:none;
       		border-radius:0;
       		font-size:12px;
       		line-height:initial;
       		margin:0!important;
   
       	}
   
       .cookie-notice-consent__revoke-button:hover {
       	background-color:#545454;
       	text-shadow:0 0 1px #000;
       	color:#fff!important;
       	margin:0!important;
   
       }
       .cookie-notice-consent__revoke-button:active {
       	background-color:#212121;
       	background-image:none;
       	color:#fff;
       	text-shadow:none;
       	font-weight:bold;
       	transition:.2s;
       	position:fixed;
       	padding:5px 15px;
       	bottom:0;
       	height:auto;
       	width:auto;
       	left:5%;
       	z-index:99999999;
       	box-shadow:0 0 10px #000;
       	border:none;
       	border-radius:0;
       	font-size:12px;
       	line-height:initial;
   
       }
   
       </style>
       ```
   
 * This way we also give a touch of style to our button. Let me know if it works!!!

The topic ‘Shortcode in footer.php solution’ is closed to new replies.

 * ![](https://ps.w.org/cookie-notice-consent/assets/icon-256x256.png?rev=2471736)
 * [Cookie Notice & Consent](https://wordpress.org/plugins/cookie-notice-consent/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/cookie-notice-consent/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/cookie-notice-consent/)
 * [Active Topics](https://wordpress.org/support/plugin/cookie-notice-consent/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/cookie-notice-consent/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/cookie-notice-consent/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [semplicewebsite](https://wordpress.org/support/users/semplicewebsite/)
 * Last activity: [4 years, 5 months ago](https://wordpress.org/support/topic/shortcode-in-footer-php-solution/)
 * Status: not a support question