Jump to content
Sign in to follow this  
dipaksaraf

Adding MP3 Player below footer in Home page

Recommended Posts

dipaksaraf

Hello I am using PlatfromPro and I want to add a MP3 player below the footer of the Home Page.

<?php
	echo jwplayer_tag_callback("[jwplayer config="Custom Player1" playlistid="435"]")?>

Where do i add this code in the Home page? Thanks Dipak

Share this post


Link to post
Share on other sites
cmunns

You will want to use a hook. Something like this should be pasted into your functions.php file in -Base ` add_action ('pagelines_after_footer','player'); function player(){ echo jwplayer_tag_callback("[jwplayer config="Custom Player1" playlistid="435"]"); } `

Share this post


Link to post
Share on other sites
dipaksaraf

Hello Adam When I am adding the code in Functions.php i get the parsing error. Secondly when i am adding this code in function.php this functionality of player will be available for all the pages i think, but i want the player for Home page only, How to do it? Dipak

Share this post


Link to post
Share on other sites
catrina

Do you have Base activated? Also, where in the functions.php file are you adding the code?


Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
dipaksaraf

HEllo Catarina i guess where i was doing the mistake, i was adding the code at the end of function.php, whereas it has to be insterted in Base Function. Now if i insert this function How do i call the player in Home page only?

Share this post


Link to post
Share on other sites
kastelic

You can use a wordpress conditional: http://codex.wordpress.org/Conditional_Tags For example:

if ( is_front_page() ){
	//your code goes here.
	}
or you could use CSS, for example:
#my-vid-div {display:none}
	.home #my-vid-div {display:block}

Share this post


Link to post
Share on other sites
dipaksaraf

Hello I was trying to edit the function.php file as suggested above in platformbase folder, but got error so i reverted the changes. Now i am unable to access the WP-admin and its giving following error.

"Warning: Cannot modify header information - headers already sent by (output started at /home/kings28/public_html/test2/wp-content/themes/platformbase/functions.php:1) in /home/kings28/public_html/test2/wp-includes/pluggable.php on line 890"
The code in function.php are as follows :
<?php
	
	// Setup  -- Probably want to keep this stuff...
	
		// Set up action for section registration...
	
		add_action('pagelines_register_sections', 'base_sections');
	
		/* Hello! First, lets load the PageLines core so we have access to the functions */
	
		require_once(TEMPLATEPATH . "/core/core.init.php");
	
	// ====================================================
	
	// = BASE FUNCTIONS - Where you should add your code  =
	
	// ====================================================
	
	 // Hooks are a way to easily add custom functions and content to the Platform theme. There are hooks placed strategically throughout the theme
	
	 // so that you insert code and content with ease.
	
	 // Below is an example of how you would add a social media icon to the icons in header (branding section)
	
	 // We have placed a hook at the end of the icon set specifically add new icons without modifying code or having to worry about your edits
	
	 // getting thrown out during the upgrade process. The way to use hooks goes a little like this:
	
		// add_action('hook_name','function name');
	
		add_action('pagelines_branding_icons_end', 'add_icons_to_branding');
	
		// function name
	
		function add_icons_to_branding(){
	
		// what the function does??“in this case adds a stumbleupon icon to the header of your theme. The class referenced in the link can be seen in the style.css
	
		// and is the image from the CSS is placed in the images folder
	
			?>
	
			
	
	<?php }
	
		// end function
	
	 // A full list of hooks can be seen by toggling the "advanced" button on each section in the "template setup" option tab. Each hook listed is associated with the section that it is listed under. That's all! Start adding hooks below.
	
	/*
	
		Register a Drag&Drop HTML Section for the admin.
	
		A pullquote section was created here for demonstration purposes
	
		Sections should be named: section.[your section name].php and placed in the sections folder.
	
	*/
	
	function base_sections(){
	
	/*
	
		Your custom sections get registered in here...
	
		PageLines Register Section Arguments:
	
			1. Section Class Name,
	
			2. Directory name (or filename if in root of 'sections' folder),
	
			3. Init Filename (if different from directory name),
	
			4. Section setup and variable array
	
	*/
	
		pagelines_register_section('BasePullQuote', 'pullquote', null, array('child' => true) );
	
		pagelines_register_section('BaseSidebar','sb_base', null, array('child' => true) );
	
	}[/code]

Please suggest.

Share this post


Link to post
Share on other sites
catrina

First you'll need to re-upload the original functions.php file (via FTP) so that it's back to normal and then you can make changes again.


Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
dipaksaraf

Thanks I did the same and WP-admin was back again, bt i am still stumbled in the MP3 player issue. As suggested by Adam i should add this code in function.php:

add_action ('pagelines_after_footer','player');
	
	function player(){
	echo jwplayer_tag_callback("[jwplayer config="Custom Player1" playlistid="435"]");
	}
This will make player visible in all the pages, am i correct? Now if i want to display it only in the home page as suggested by jimmy i can use
if ( is_front_page() ){
	//your code goes here.
	}
	
	or
	
	#my-vid-div {display:none}
	.home #my-vid-div {display:block}

the same can be used if i am coding or calling the function from the page or post, but since i am using the hook by default it is already executed. is it correct?? or I have to call it in the pages i want manually like player(). Please suggest I am still confused at this point.

Share this post


Link to post
Share on other sites
catrina
or I have to call it in the pages i want manually like player(). Please suggest I am still confused at this point.
Yes, you will have to call it in the specific pages that you want it to appear in if you don't it in any other pages.

Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×