我的模板页面中有以下代码,我在主题中注册了jquery和fittextfunctions.php
. 当我设置它们时,它们当前显示在页脚中。我可以在页眉或页脚中设置它们,但fittext在我放置它的任何地方都不起作用。当我缩小屏幕尺寸时,字体应该会缩小,但事实并非如此。我不知道为什么会这样。
我已经建立了一个非常粗略的网站版本,它基本上只是显示了fittext不起作用,你可以查看它here 用户名:anders,密码:reading61
<?php
/*
Template Name:Tech Basics
*/
?>
<?php get_header( \'tech\' ); ?>
<div id="quote">
<h1 id="fittext3">Sending you the techie! son you never had.</h1>
</div>
<script type="text/javascript">
$("#fittext3").fitText();
</script>
<div class="row mainContent">
<div class="twelve columns">
<?php
$page_id = 10; // 123 should be replaced with a specific Page\'s id from your site, which you can find by mousing over the link to edit that Page on the Manage Pages admin page. The id will be embedded in the query string of the URL, e.g. page.php?action=edit&post=123.
$page_data = get_page( $page_id ); // You must pass in a variable to the get_page function. If you pass in a value (e.g. get_page ( 123 ); ), WordPress will generate an error. By default, this will return an object.
echo apply_filters(\'the_content\', $page_data->post_content); // echo the content and retain Wordpress filters such as paragraph tags. Origin from: http://wordpress.org/support/topic/get_pagepost-and-no-paragraphs-problem
?>
</div>
</div><!--row ends-->
<?php get_footer(); ?>
This seems to get it working however I know it isn\'t a proper technique, for some reason fittext wants the js right in the middle of the page can any one help with this.
<?php
/*
Template Name:Tech Basics
*/
?>
<?php get_header( \'tech\' ); ?>
<div id="quote">
<h1 id="fittext3">Sending you the techie! son you never had.</h1>
</div>
<script type="text/javascript">
$("#fittext3").fitText();
</script>
<h2 id="fittext1">Welcome to Foundation</h2>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="http://localhost:8888/austin.kitson.orgWP/wp-content/themes/git.austin.kitson.org/js/jquery.fittext.js"></script>
<script type="text/javascript">
$("#fittext1").fitText();
$("#fittext2").fitText(1.2);
$("#fittext3").fitText(1.1, { minFontSize: 50, maxFontSize: \'75px\' });
</script>
<div class="row mainContent">
<div class="twelve columns">
<?php
$page_id = 10; // 123 should be replaced with a specific Page\'s id from your site, which you can find by mousing over the link to edit that Page on the Manage Pages admin page. The id will be embedded in the query string of the URL, e.g. page.php?action=edit&post=123.
$page_data = get_page( $page_id ); // You must pass in a variable to the get_page function. If you pass in a value (e.g. get_page ( 123 ); ), WordPress will generate an error. By default, this will return an object.
echo apply_filters(\'the_content\', $page_data->post_content); // echo the content and retain Wordpress filters such as paragraph tags. Origin from: http://wordpress.org/support/topic/get_pagepost-and-no-paragraphs-problem
?>
</div>
</div><!--row ends-->
<?php get_footer(); ?>