Action hook not applying?
-
So I’m building a child theme for the website I am building and i have the style.css there and its working fine but the function.php doesn’t seem to want to attach to any of the action hooks. Below is the code, is it possible that i attached it wrong?
<?php
function project_loader() {?>
<!-- Project Wonderful Ad Box Loader -->
<!-- Put this after the <body> tag at the top of your page -->
<script type="text/javascript">
(function(){function pw_load(){
if(arguments.callee.z)return;else arguments.callee.z=true;
var d=document;var s=d.createElement('script');
var x=d.getElementsByTagName('script')[0];
s.type='text/javascript';s.async=true;
s.src='//www.projectwonderful.com/pwa.js';
x.parentNode.insertBefore(s,x);}
if (window.attachEvent){
window.attachEvent('DOMContentLoaded',pw_load);
window.attachEvent('onload',pw_load);}
else{
window.addEventListener('DOMContentLoaded',pw_load,false);
window.addEventListener('load',pw_load,false);}})();
</script>
<!-- End Project Wonderful Ad Box Loader -->
<?php }
add_action( 'graphene_container_before', 'project_loader' );
function header_logo() {?>
<div class="headerbar">
<a href="<?php bloginfo('url'); ?>"><img src="http://test.ariablarg.tv/logo.png" alt="<?php bloginfo('name'); ?>" title="<?php bloginfo('name'); ?>" class="alignleft" /></a>
<div class="adbox">
<!-- Project Wonderful Ad Box Code top banner -->
<div id="" class=""></div>
<script type="text/javascript"></script>
<!-- End Project Wonderful Ad Box Code -->
</div>
</div>
<?php }
add_action( 'graphene_header', 'header_logo' );
function add_this() {?>
<div class="addthis_toolbox" style=" margin-bottom:10px;">
<div class="custom_images">
<a class="addthis_button_twitter"><img src="<?php bloginfo('template_directory'); ?>/images/socialicons/twitter.png" width="32" height="32" alt="Twitter" /></a>
<a class="addthis_button_delicious"><img src="<?php bloginfo('template_directory'); ?>/images/socialicons/delicious.png" width="32" height="32" alt="Delicious" /></a>
<a class="addthis_button_facebook"><img src="<?php bloginfo('template_directory'); ?>/images/socialicons/facebook.png" width="32" height="32" alt="Facebook" /></a>
<a class="addthis_button_digg"><img src="<?php bloginfo('template_directory'); ?>/images/socialicons/digg.png" width="32" height="32" alt="Digg" /></a>
<a class="addthis_button_stumbleupon"><img src="<?php bloginfo('template_directory'); ?>/images/socialicons/stumbleupon.png" width="32" height="32" alt="Stumbleupon" /></a>
<a class="addthis_button_more"><img src="<?php bloginfo('template_directory'); ?>/images/socialicons/more.png" width="32" height="32" alt="More" /></a>
</div>
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js?pub=xa-4a65e1d93cd75e94"></script>
</div>
<?php }
add_action( 'graphene_before_sidebar1', 'add_this' );
?>Try using Action Hooks Widgets instead. (With WP-PHP-widget if needed)
Ok but I do want to know why its not hooking in the first place
Did you clear browser and server cache?
Browser has been cleared, and the test website shouldn’t have a cache still nothing
Check Ad Box Loader code. Custom Logo and add_this looks fine. (In fact, it is working in my test site)
Took out the ad loader script still no change, checked in a different browser and code is still not there. Do I need to do a unhook somewhere in the function.php?
Mod
Your PHP is wonky. There’s no
include
orecho
statement, you have closing PHP tags (?>
) just after your function declarations, quotation marks are not escaped.Try taking a look at this post to see how to format these:
http://www.nathanrice.net/blog/an-introduction-to-wordpress-action-hooks/
Viewing 8 posts - 1 through 8 (of 8 total)
- You must be logged in to reply to this topic.