Jump to content
Sign in to follow this  
studentkrubb

Using hooks

Recommended Posts

studentkrubb

Hello, I'm trying to figure out the exact way to position a fb script at the top right of my canvas, this is where I'm at:

//add_action('pagelines_after_branding', 'fb_like_box');
	
		// function name
		function fb_like_box(){
			?>
			<script src="http://connect.facebook.net/sv_SE/all.js#xfbml=1"></script><fb:like-box href="http://www.facebook.com/pages/Studentkrubb/124075264272163" width="292" show_faces="false" stream="false" header="false"></fb:like-box>
		<?php }
		// end function

Do I have to add anything else to make it work? If so - what and where? Thanks in advance!

Share this post


Link to post
Share on other sites
bryan-hadaway

Looks like you have: `//add_action('pagelines_after_branding', 'fb_like_box');` commented out, you'd want to remove `//` Also I can tell you now you'll need to use CSS to further position it exactly where you want. Thanks, Bryan

Share this post


Link to post
Share on other sites
studentkrubb

Thanks! It still doesn't show at all though. Do I have to do anything before I add the code to the functions.php?

Share this post


Link to post
Share on other sites
bryan-hadaway

There could be syntax errors. Marking for developer review. Thanks, Bryan

Share this post


Link to post
Share on other sites
studentkrubb

Okey! Nothing to do atm then? Thanks!

Share this post


Link to post
Share on other sites
Simon

There is no such action `pagelines_after_branding` There is however `pagelines_after_branding_wrap` ;) Try that.

Share this post


Link to post
Share on other sites
studentkrubb

Good spot! Thank you. Did not make them appear though. Any other guesses?

Share this post


Link to post
Share on other sites
cmunns

the fb_like button iframe can be nitpicky. What is the live link?

Share this post


Link to post
Share on other sites
bryan-hadaway

Stay tuned for further support on this issue. Thanks, Bryan

Share this post


Link to post
Share on other sites
studentkrubb

Any news on this topic? Thanks in advance!

Share this post


Link to post
Share on other sites
bryan-hadaway

Pushing it through now... Thanks, Bryan

Share this post


Link to post
Share on other sites
cmunns

Nothing is showing up at all in the HTML. try wrapping your FB script with a HTML div and add a class to it or some text content so you can test the hook itself. If that works then you know it's the FB code itself.

Share this post


Link to post
Share on other sites
studentkrubb

Tried wrapping the fb script with a div and some text, but still nothing showed. Pasting my functions.php if you may spot any errors which I can't see:

<?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");
	
		// For advanced customization tips & code see advanced file.
		//--> require_once(STYLESHEETPATH . "/advanced.php");
	
	// ====================================================
	// = BASE FUNCTIONS - Where you should add your code  =
	// ====================================================
	
	// ADDING CUSTOM SECTIONS ------- //
		// 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) );
	
		}
	
	// ABOUT HOOKS --------//
		// 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.
	
	// HOOKS EXAMPLE --------//
		// 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_before_branding','fb_like_box');
	
		// function name
		function fb_like_box(){
			?>
			<script src="http://connect.facebook.net/sv_SE/all.js#xfbml=1"></script><fb:like-box href="http://www.facebook.com/pages/Studentkrubb/124075264272163" width="292" show_faces="false" stream="false" header="false"></fb:like-box>
		<?php }
		// end function
	
	// ADDING NEW TEMPLATES --------//
		// Want another page template for drag and drop? Easy 
		// 			1. Add File called page.[page-id].php to Base
		// 			2. Add /* Template Name: Your Page Name */ and Call to 'setup_pagelines_template();' to that file (see page.base.php)
		// 			3. Add 'pagelines_add_page('[page-id]', '[Page Name]');' to this functions.php file
	
		// Add Base Page
		pagelines_add_page('base', 'Custom Page');
	
	// OVERRIDE SECTION TEMPLATES --------//
		// Want more customization control over any of the core section templates in PlatformPro? Just override the template file.
		// To do that, just add a file called template.[section-id].php to this child theme and it will override the section templates
		// for the section with that ID.  For example, template.boxes.php will override the boxes templates.
		// Once overridden you can copy the code from that section, paste it there and edit to your heart's content.
	
	[/code]

Thanks!

Share this post


Link to post
Share on other sites
bryan-hadaway

Have you considering using a plugin with a widget being placed where you want instead of hooks which are a little more advanced? If you'd like further help with hooks please wait for the developers. Thanks, Bryan

Share this post


Link to post
Share on other sites
Andrew

Are you sure this is the correct markup for websites? That FBML is never gonna validate. Have you tested the markup with some thing else? Like a simple 'testing 123'...

Share this post


Link to post
Share on other sites
Simon

Tested: `// function name` `function fb_like_box(){` `echo '

';` `echo '

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  

×