I have attempted to put my script into a page I have created but can't seem to get the script to work correctly. It is a paginate script which links to the "newsblocks" class. Where do I place the script to make it work?
<?php
/*
Template Name: [Newspage]
*/
get_header();?>
<div id="main" class="defaultContentWidth">
<div id="wrapper-row">
<div id="primary">
<div id="content">
<?php the_breadcrumb();?>
<h1 class="entry-title"><?php the_title();?></h1>
<?php if(have_posts()) :
while(have_posts()) : the_post();?>
<div class="newscont"><?php the_content();?></div>
<?php endwhile;
endif;?>
<script type="text/javascript" src="<?php bloginfo('template_directory');?>/javascript/jquery.pajinate.js"></script>
<div class="contnewslist">
<ul class="newsblocks">
<li>
<h2>NEWSLETTER 1</h2>
<i>November 01, 2014</i>
<p>This is the November edition of the newsletter for The Dry Cleaner App. Featuring in this newsletter is ...</p>
<input type="submit" value="Download" id="submit" class="newsdownload">
</li>
For Optimizing the performance of a webpage it's always recommended to put the Javascript file to your footer.
So load your script files in your footer file.
In wordpress you've a footer.php
Change
<script type="text/javascript" src="<?php bloginfo('template_directory');?>/javascript/jquery.pajinate.js"></script>
TO
<script type="text/javascript" src="<?php echo echo get_template_directory(); ?>/javascript/jquery.pajinate.js"></script>
try to add js with get_template_directory_uri()
<script type="text/javascript" src="<?php echo get_template_directory_uri(); ?>/javascript/jquery.pajinate.js"></script>
and add js to your theme footer.php or in same page footer or where you need
also i think typo here :- jquery.pajinate.js should be jquery.paginate.js
I'm thinking <?php bloginfo('template_directory');?> should be changed to <?php echo bloginfo('template_directory');?> but since you didn't gave us the definition of bloginfo() function we can't really do much..
Related
I create custom theme and I am trying to create a contact form using wpform but for some reasons the form doesn't show on my page
here is a code from the custom theme
<?php
/* Template Name: CallUS*/
get_header();?>
<section>
<div class="u-clearfix u-sheet u-valign-middle-xs u-sheet-1">
<h1>
call us
</h1>
<img
class="u-image u-image-default u-image-1 u-hidden-xs"
src="<?php bloginfo('template_directory');?>/images/---1113.png"
alt=""
data-image-width="800"
data-image-height="972"
/>
</div>
</section>
<?php get_footer();?>
and this picture from the form that I have created using wpform
Way 01:
You must have the_content() function in order to show page contents. I've edited your code so you can see how to do it:
<?php
/* Template Name: CallUS*/
get_header();?>
<section>
<div class="u-clearfix u-sheet u-valign-middle-xs u-sheet-1">
<h1>
call us
</h1>
<img
class="u-image u-image-default u-image-1 u-hidden-xs"
src="<?php bloginfo('template_directory');?>/images/---1113.png"
alt=""
data-image-width="800"
data-image-height="972"
/>
<?php
while ( have_posts() ) :
the_post();
the_content();
endwhile; // End of the loop.
?>
</div>
</section>
<?php get_footer();?>
Then you've to select CallUS Page Template from below page:
Way 02:
If you go to the WPForms from the menu then you can see the shortcode column on each row. it will be like [wpforms id="123"]
Copy your design shortcode from there and use that directly into your file like below:
<?php
/* Template Name: CallUS*/
get_header();?>
<section>
<div class="u-clearfix u-sheet u-valign-middle-xs u-sheet-1">
<h1>
call us
</h1>
<img
class="u-image u-image-default u-image-1 u-hidden-xs"
src="<?php bloginfo('template_directory');?>/images/---1113.png"
alt=""
data-image-width="800"
data-image-height="972"
/>
<?php echo do_shortcode('[wpforms id="3306"]');?>
</div>
</section>
<?php get_footer();?>
I'm working on a project where I have audio, video and picture files in different directories and want to write a simple web interface for those. I got everything working pretty good so far, pictures are displayed by lightbox, audio and video are played by jPlayer.
I have a directory stucture like this
ARCHIVE/
_RES/
CSS/
JPLAYER/
LIGHTBOX/
index.php #this is the start page with links to the other index.php files
VIDEO/
PICTURES/
ALBUM1/
IMG/
T_IMG/
index.php
ALBUM2/
IMG
T_IMG/
index.php
ALBUMn/
IMG/
T_IMG/
index.php
AUDIO
ALBUM1
index.php
OGG/
SONG#1.ogg
SONG#n.ogg
SONG FUN. ogg
MP3/
SONG#1.mp3
SONG#n.mp3
SONG FUN.mp3
My Problem now is, when I want to change something, for example, in the audio player, I have to edit every index.php in every ALBUMx/ directory inside AUDIO.
I'm sure there is a much simpler way: instead of have many index.php files, just having one index.php file, and when I click on link, AUDIO -> ALBUM1 it automatically loads a .html document that shows the audio player and fills the playlist with the audio files from the Album I choose.
This is example code for my AUDIO ALBUM index.php.
The ones for Pictures and Video look similar, except for having different player option e.g. for video or, in case of pictures, in has a lightbox implemented.
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html">
<link href="/archive/_res/style.css" rel="stylesheet" />
<?php
$parent = dirname(dirname($_SERVER['SCRIPT_NAME'])) . '/';
$dirname = basename(__DIR__);
echo '<title>'.$parent.$dirname.' </title>';
?>
<link href='http://fonts.googleapis.com/css?family=Raleway:100,400' rel='stylesheet' type='text/css'>
<!-- JPLAYER AUDIO VIDEO -->
<!--link type="text/css" href="../../_res/jplayer/skin/pink.flag/jplayer.pink.flag.css" rel="stylesheet" /-->
<link type="text/css" href="../../_res/jplayer/skin/blue.monday/jplayer.blue.monday.css" rel="stylesheet" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
<script type="text/javascript" src="../../_res/jplayer/jquery.jplayer.min.js"></script>
<script type="text/javascript" src="../../_res/jplayer/jplayer.playlist.min.js"></script>
<?php
$mp3folder = 'mp3/';
$oggfolder = 'ogg/';
$filetype = '*.*';
$mp3files = glob($mp3folder.'*.mp3');
$oggfiles = glob($oggfolder.'*.ogg');
echo '
<script type="text/javascript">
$(document).ready(function(){
new jPlayerPlaylist({
jPlayer: "#jquery_jplayer_1",
cssSelectorAncestor: "#jp_container_1"
}, [';
for ($i=0; $i<count($mp3files); $i++) {
$namerr[$i] = substr($oggfiles[$i],strlen($oggfolder),strpos($oggfiles[$i], '.')-strlen($oggfolder));
echo '{'."\n";
echo 'title:"'.$namerr[$i].'",'."\n";
echo 'mp3:"'.dirname($mp3files[$i]).'/'.rawurlencode(basename($mp3files[$i])).'",'."\n";
echo 'ogg:"'.dirname($oggfiles[$i]).'/'.rawurlencode(basename($oggfiles[$i])).'",'."\n";
echo 'free: "true"'.','."\n";
echo 'poster:"'.$mp3folder.'cover.png",'."\n";
echo '},'."\n";
}
echo '
], {
swfPath: "../../_res/jplayer",
supplied: "ogg, mp3",
wmode: "window",
size: {
width: "300px",
height: "300px",
cssClass: "jp-video-240p"
},
smoothPlayBar: true,
keyEnabled: true
});
});
</script>';
?>
<!-- JPLAYER AUDIO VIDEO //-->
<script>
function bottop (div_id) {
$('#'+div_id).animate({top:"-=140"},500, 'swing');
}
function topbot (div_id) {
$('#'+div_id).animate({top:"+=140"},500, 'swing');
}
function fade_in (div_id) {
$('#'+div_id).fadeIn(0);
}
function fade_out (div_id) {
$('#'+div_id).fadeOut(0);
}
</script>
</head>
<body>
<div id="shownav" class="shnav">
<span class="thinl4 db" onclick="topbot('topper');fade_out('shownav');">Show Navigation bar!</span>
</div>
<div id="topper">
<div id="hidenav" class="shnav">
<span class="thinl4 db" onclick="bottop('topper');fade_in('shownav');">Hide Navigation bar!</span>
</div>
<div id="backtoarchive" class="fl thinl">
<table id="keks">
<tr>
<td class="bif"><</td>
<td id="bli">Back to Archive</td>
</tr>
</table>
</div>
<?php include '/var/www/webaccount/html/archive/_res/nav.php'; ?>
<?php
$parent = dirname(dirname($_SERVER['SCRIPT_NAME'])) . '/';
$dirname = basename(__DIR__);
echo '<div id="where" class="fl">';
echo 'You are here: <em>'.$parent.$dirname.'</em>';
echo '</div>';
?>
</div>
<div id="jplayer-wrap">
<div id="jp_container_1" class="jp-video jp-video-270p">
<div class="jp-type-playlist">
<div id="jquery_jplayer_1" class="jp-jplayer"></div>
<div class="jp-gui">
<div class="jp-video-play">
play
</div>
<div class="jp-interface">
<div class="jp-progress">
<div class="jp-seek-bar">
<div class="jp-play-bar"></div>
</div>
</div>
<div class="jp-current-time"></div>
<div class="jp-duration"></div>
<!-- added style below to fix floating issue (default was clear:both by css) -- not important to code function -->
<div class="jp-controls-holder" style="clear:left;">
<ul class="jp-controls">
<li>previous</li>
<li>play</li>
<li>pause</li>
<li>next</li>
<li>stop</li>
<li>mute</li>
<li>unmute</li>
<li>max volume</li>
</ul>
<div class="jp-volume-bar">
<div class="jp-volume-bar-value"></div>
</div>
<ul class="jp-toggles">
<li>full screen</li>
<li>restore screen</li>
<li>shuffle</li>
<li>shuffle off</li>
<li>repeat</li>
<li>repeat off</li>
</ul>
</div>
<div class="jp-title">
<ul>
<li></li>
</ul>
</div>
</div>
</div>
<div class="jp-playlist">
<ul>
<!-- The method Playlist.displayPlaylist() uses this unordered list -->
<li></li>
</ul>
</div>
<div class="jp-no-solution">
<span>Update Required</span>
To play the media you will need to either update your browser to a recent version or update your Flash plugin.
</div>
</div>
</div>
</div>
</body>
</html>
I guess I would have to make single "modules" that contain the jplayer/lightbox stuff and <?php include .. ?> those and have it load the correct files.
So when I click on a link for AUDIO -> ALBUM1 the html/php link should load something like
index.php?load=audio,files=audio/album1
If someone has a hint for me, it would be so great!!!
This is my first PHP Project and I'm keen to learn!
Thank you,
vincent.
I have a php page that has many includes. The whole page runs fine, but for my navigation bar, it does not open any page when I click on it. Please, what is missing here. Any help will be appreciated. many thanks
Here are my codes for the includes
<div id='cssmenu'>
<ul>
<li class='active'><span>Home</span></li>
<li><span>About Us</span></li>
<li><span>Packages</span></li>
<li><span>Partners</span></li>
<li><span>Gallery</span></li>
<li class='last'><span>Contact Us</span></li>
</ul>
</div>
And here is my main page code:
<body>
<div id="wrapper">
<div>
<img src="images/banner.png" width="940" height="200" />
</div>
<?php include('includes/nav.php'); ?>
<?php include('includes/slider.php'); ?>
<?php include('includes/nav.php'); ?>
<?php include('includes/contents.php'); ?>
<?php include('includes/sidebar.php'); ?>
<?php include('includes/footer.php'); ?>
</div> <!-- End #wrapper -->
</body>
Not sure of your file structure, but try removing the '../' on all you links
Change this:
<li class='active'><span>Home</span></li>
to this:
<li class='active'><span>Home</span></li>
Take the ../ out of your path.
When you include the nav.htm to your main page it acts as if it is in the main folder
Therefore if you use '../' it won't find it.
I have installed IIS7.5 on my box for development including php of course, and i have copied my wordpress site from my live server and changed the url settings in the db etc.
however when visiting the homepage none of the style or meta data associated in the header.php file is rendered. looking at the source code it changes the default php function
<?php get_header(); ?>
to include the header.php file and it gets rendered to the browser as
<? get_header(); ?>
i.e it is viewable as such in the view source.
other php functions and includes and php generally seems to be running ok in other files... i have mantisBT install running smoothly for example.
i have already tried copying the files from the server again and then using a fresh install of wordpress too.
accessing the wp-admin all seems to work ok
Does anyone have any ideas what might be causing this?
ta
EDIT: adding index.php file - very vanilla.
<?php get_header(); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<!-- Begin Post: <?php the_title(); ?> -->
<div class="post">
<h3 class="posttitle"><?php the_title(); ?></h3>
<div class="title"><div class="postmetadata"><?php the_time('F jS, Y'); ?> by <?php the_author(); ?> in <?php the_category(', '); ?></div></div>
<div class="entry">
<?php the_content(); ?>
</div>
<div class="tags"><div class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?></div></div><div class="comments"><div class="postmetadata"><?php comments_popup_link('No Comments', '1 Comment', '% Comments'); ?> <img src="<?php bloginfo('template_directory'); ?>/images/comment.png" alt="Comments" /></div></div>
</div><br /><br /><br />
<!-- End Post: <?php the_title(); ?> -->
<?php endwhile; ?>
<div class="navigation">
<div class="alignleft"><?php next_posts_link('« Older Entries') ?></div>
<div class="alignright"><?php previous_posts_link('Newer Entries »') ?></div>
</div>
<?php else: ?>
<p>Sorry, no posts matched your criteria.</p>
<?php endif; ?>
</div>
<!-- Include Sidebars -->
<?php include (TEMPLATEPATH . '/sidebarR.php'); ?>
<?php include (TEMPLATEPATH . '/sidebarL.php'); ?>
</div>
<?php get_footer(); ?>
EDIT: added header.php - also pretty vanilla
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
<link href="style.css" rel="stylesheet" type="text/css"/>
<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" />
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
<?php wp_head(); ?>
<title><?php if (is_single() || is_page() || is_archive()) { ?><?php wp_title('',true); ?> | <?php } ?><?php bloginfo('name'); ?></title>
</head>
<body>
<div id="navwrap">
<div id="nav">
<div class="navpad">
<ul class="navi">
<li class="page_item"></li>
</div>
</div>
</div>
<div id="header">
<div class="headpad">
</div>
</div>
<div id="wrapper">
<div id="content">
UPDATE:
still getting the same issue, have reinstalled php 5.3.8, checked encoding, saved files as utf-8 without BOM. still no joy.
<? get_header(); ?>
<div class="post">
UPDATE 2:
Still not got this to work, the code is standard for a wordpress theme, i've installed another theme and it seems to work ok, so i doubt it is a IIS7 issue.
i've looked at the encoding of files and made sure everything is utf-8.
all my wordpress core files are intact and up to date.
This Row in the Wordpress Template File is a php code, which should be processed on server-side, it shouldn't be visible in the Source Code when you're calling the Page with IIS
<?php get_header(); ?>
Check your php installation and rewrite the PHP-Open Tag <?php and the PHP-Close Tag ?> manually. There can also be an encoding issue between the Tags. Also try do edit the document with another editor, or try to change the Encoding Type to UTF-8. If it still fails then attach your Template header.php here.
If you are not using any <?xml ?> in your code, then you might try adding short_open_tag 1 to your php.ini. It looks like you environment might be stripping the php from the tag <?php and if you are using PHP 5.3+ short_open_tag is disabled by default and won't render.
The preference is to have short_open_tag disabled, and it would be worth looking to find out what the php is bring removed from the <?php, but setting the configuration setting to 1 might at least get it working for now.
Instead of <?php get_header(); ?> try the direct include method <?php include_once("header.php"); ?> and let me know what happend.
Also <?php get_footer(); ?> works correctly or it is also displays in the source code. Thanks
it appears a number of issues helped fix it to a certain extent...
removed ~ from folder name in path.
added test.xyz.com addresses to host file
added these addresses to II7.5
updated wordpress db to reflect the new addresses.
rewritten index.php of theme file and rewritten the call to the get_header function.
wasted too much of my life on this...
result:
localhost/path/to/index.php now works and loads the header as expected. but not all the content (page not found on homepage).
test.xyz.com/index.php doesn't load header and still shows <? get_header(); ?> and the equivalent for the footer file.
So I am working on my first wordpress site...
I am having a go at converting http://www.benjaminpotter.org/fleet/
to wordpress > http://www.benjaminpotter.org/test/
So there are already a few issues, but one of the things is that I am wanting to call content into the "about us" section on the index page via wordpress to act as a CMS.
This is an image of the back end:
nevertheless it ends up with no content in that section:
this is most likely because I need to put in a bit of code into the page of the website.
This is the current code for that page, and I have commented where I want to call the content mannaged bit... thanks for the help!
<? /* Template Name: Home Page
*/ ?>
<?php get_header(); ?>
<div id="tagline"></div>
<div id="sliderbox">
<img src="<?php bloginfo('template_url'); ?>/images/index/slider/slider_1.jpg" width="1000" height="466" alt="Don't settle for less" />
<img src="<?php bloginfo('template_url'); ?>/images/index/slider/slider_2.jpg" width="1000" height="466" alt="Don't settle for less" />
<img src="<?php bloginfo('template_url'); ?>/images/index/slider/slider_3.jpg" width="1000" height="466" alt="Don't settle for less" />
<img src="<?php bloginfo('template_url'); ?>/images/index/slider/slider_4.jpg" width="1000" height="466" alt="Don't settle for less" />
</div>
<a id="arrow2" class="arrow"></a>
<a id="arrow1" class="arrow"></a>
<a href="order.php" id="car_logo_slider" onmouseover="tooltip.show('');" onmouseout="tooltip.hide();">
<img src="<?php bloginfo('template_url'); ?>/images/index/car_slider/cars1.jpg" width="1001" height="86" alt="cars" />
<img src="<?php bloginfo('template_url'); ?>/images/index/car_slider/cars2.jpg" width="1001" height="86" alt="cars" />
<img src="<?php bloginfo('template_url'); ?>/images/index/car_slider/cars3.jpg" width="1001" height="86" alt="cars" />
</a>
<div id="wrapper-contunue">
<div id="mission_vision_header"></div>
<? include('inc/quickcontact.html'); ?>
<div id="mission_vision_text">
<!-- THE CONTENT MANAGED BIT! -->
<!-- THE CONTENT MANAGED BIT! -->
<!-- THE CONTENT MANAGED BIT! -->
<!-- THE CONTENT MANAGED BIT! -->
<!-- THE CONTENT MANAGED BIT! -->
</div>
<div style="margin-top:450px;" class="seperator"></div>
<div id="our_process" class="highlighed_div">
<div id="our_process_header"></div>
<div id="initial_text_our_process">
Here at Fleet Avenue, we have a simple and straight forward process towards acquiring our cars for you. This four step process is fast and effective, consisting of the following steps:
</div>
<div id="our_process_stages_graphic"></div>
<div id="explanatiory_text_our_process">
<div id="process_inquire">
<a id="inquire_button" href="order.php"></a>
</div>
</div> <?php get_footer(); ?>
<?php echo get_content(); ?>
Or
<?php
global $post;
echo $post->post_content;
?>
i believe you need to wrap you call to the_content() in the Wordpress loop
<?php
if ( have_posts() ) {
while ( have_posts() ) {
the_content();
} // end while
} // end if
?>
this is a very basic example if you make other calls later you will need to reset the query call after this one.
more info here: https://codex.wordpress.org/The_Loop