I have been given this code that I want to adapt and use to change a link in a template.php
file, I have not been able to adapt it to work so would love any help that can be given.
<script type="text/javascript">
jQuery(document).ready(function($) {
if ( $(document).width() < 1500 ) {
$('.change-link > a').each( function(){
newlink = 'Enter New URL';
$(this).attr('href',newlink);
});
}
});
</script>
Will it work in a template.php
and be able to choose between this link:
<?php include( TEMPLATEPATH . '/includes/projects.php'); ?>
and this link depending on the browser size?
<?php include( TEMPLATEPATH . '/includes/projects.php'); ?>
Or will it require more code in other pages of my WordPress theme?
wp_register/enqueue_style/script()
functions and about stuff likeget_template_directory()
and similars in Codex.