Jump to content
Sign in to follow this  
djb21au

Using hooks to remove content: need a map to find the right section

Recommended Posts

djb21au

I have a basic understanding of using hooks to add and remove content, but the thing that is holding me back with PlatformPro at the moment is not being able to target the correct location for removals. For instance, I have added the metabar below my posts (at www.streetsofmytown.net), where I want it, but I want to remove it from the beginning. How do I identify the correct hook name to do this, using Firebug or otherwise? More generally, how can I identify a specific hook name for adding and removing content? (For another theme I have used, one of the developers produced a diagram which laid out the hooks on the page: it made this task much easier. Perhaps something similar could be added to the documentation?)

Share this post


Link to post
Share on other sites
catrina

You can identify a specific hook name by looking inside the parent files (they are preceded by

pagelines_register_hook
). For example, if you look in the file section.brandnav.php (which controls the branding area in the header), you'll find several hooks (i.e.
brandnav_after_nav

). There's a hook list located in Template Setup, too (if you click on Advanced Setup). Also, thanks for mentioning the hook diagram idea for the documentation. I will forward that to developers. :)


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
djb21au

Okay. So the section of the template I'm targeting is this:

<?php pagelines_register_hook( 'pagelines_loop_post_header_start', 'theloop' ); //hook ?>
									<div class="post-title-section fix">
	
										<div class="post-title fix">
	
											<?php
												pagelines_get_post_title();
												pagelines_get_post_metabar();
											?>
	
										</div>
	
									</div>
And my customised hook code is this:
	remove_action('pagelines_loop_post_header_start','pagelines_get_post_metabar');
		add_action('pagelines_inside_bottom_theloop','pagelines_get_post_metabar');

But that's not making any difference. So I'm not sure what I'm doing wrong.

Share this post


Link to post
Share on other sites
kastelic

Maybe it would be easier to hide it with CSS? Like, use Firebug to target the parent div and set it to "display:none".

Share this post


Link to post
Share on other sites
djb21au

Sorry Geert, but was your post meant to be empty?

Share this post


Link to post
Share on other sites
djb21au

Thanks for the idea Jimmy. I'm not sure that would work as the parent div's id is "post-<?php the_ID(); ?>" - if I hide that, it will hide the whole post won't it? Nevertheless, could you please give me an example of the full syntax for the hide command and I'll try it. That said, shouldn't remove_action work if I can find the right hook?

Share this post


Link to post
Share on other sites
geertbesten

Hi David, I was browsing your thread and wanted to start a new topic afterwards. Accidentily used the Reply form instead. Apologies. Geert

Share this post


Link to post
Share on other sites
djb21au

For the time being I've achieved my end by commenting out the metabar in template.postloop.php. But obviously that is a less than desirable approach. I'd still like some advice on why the remove_action command isn't working - pretty please. Or how to remove hooks, my original question, in some other smart way.

Share this post


Link to post
Share on other sites
kastelic

I'll forward to the developers, I'm not sure on the remove_action part.

Share this post


Link to post
Share on other sites
djb21au

Any response from the developers? I can't be the only person who wants to remove actions? Failing that I'd really appreciate an example of how to use "display:none"

Share this post


Link to post
Share on other sites
bryan-hadaway

- I recommend first using the Template Setup to remove what you want. - Then there is section control from page/post to page/post when editing individually - Then if it's not possibly through the settings, use CSS... which you can actually get very specific with. - Finally you could if you're using the base manually modify files Thanks, Bryan

Share this post


Link to post
Share on other sites
djb21au

Brian, Unfortunately none of that moves me in the right direction (and without wanting to sound whiney, it doesn't sound like you've read my issue as your answer is very generic). In response to each of your points: First, in terms of removing the metabar from above my posts, there is no option to do that in Template Setup. Second, there is no option to do this in on the individual post page either. Third, I'd like to use CSS but I can't work out what to target - which comes to the point of my response to your 'Frustrated' post. We can't get specific unless we know where to look. Finally, modifying the base won't help me make the change I want because the section in question is only referred to in the parent theme. And I don't want to modify the parent theme for obvious reasons. What I would like is a simple answer to a simple question: why doesn't the remove_action command work? That would solve my issue. David

Share this post


Link to post
Share on other sites
bryan-hadaway

No worries, CSS is our answer here with the help of Firebug: http://www.pagelines.com/docs/changing-colors-fonts Using Firebug, I can target the Meta Bar and find the class `metabar` So in Custom Code > Custom CSS with can drop in: `.metabar{display:none}` And goodbye Meta Bars :). Spend some time with Firebug, it's a life saver. And if you want to dive in even more: http://www.w3schools.com/css/ Thanks, Bryan

Share this post


Link to post
Share on other sites
djb21au

Thanks for the example Brian - that is part of what I was looking for. However it's not as nice a solution as remove_action because it removes all the metabars: both the one I want to get rid of and the one I had added below my posts. So unfortunately I'm still at a loss as to how to move a section like the metabar - remove from top of post, add to bottom - as opposed to just hiding it. Edit: Clearly it is possible to move code because that's what happens when we use the drag-and-drop feature to move the navbar, for instance, to the top of the header. I'm not expecting drag-and-drop for what I want to do - I just want to know what code to use to achieve the same sort of result with the more obscure sections.

Share this post


Link to post
Share on other sites
barroncuadro

Speaking to the idea of a diagram for where the hooks are placed, I was requesting that recently as well: http://www.pagelines.com/forum/topic.php?id=6833 Hopefully the devs can come up with one sooner rather than later. I always refer to thesishooks.com in this situation as it does a decent job illustrating the positioning of all the available hooks.

Share this post


Link to post
Share on other sites
djb21au

Thesis is the theme I was referring to also, Barron. Thanks for that link. Perhaps we can wish for an Openhooks equivalent here as well one day, which would make things really easy - but I won't push that yet :) That said, Thesis is where I used remove_action a lot too in order to move things around.

Share this post


Link to post
Share on other sites
Kate

We appreciate your suggestions David and Barron. And, please don't hesitate to make them ;) We value your input.

Share this post


Link to post
Share on other sites
bryan-hadaway

Hi David, all we need to do is be more specific with our CSS now. You've created two duplicate topics of this topic now that I've deleted, please don't create duplicate topics. `.post-title .metabar{display:none}` Will work to hide just the top meta bar. Now, I understand that you still wish to resolve the `remove_action` issue. I'm going to mark for developer review and see if we can get some insight. Thanks, Bryan

Share this post


Link to post
Share on other sites
djb21au

Unfortunately that doesn't work Bryan. I've tried

.post-title .metabar{display:none}
and
.post-title .entry-title .metabar{display:none}

Neither of these removes the metabar. Apologies for the duplicates - I'm still trying to work out how to use this forum effectively without being forgotten as my post slips down the list. And yes, I would really like an answer on the remove_action point - I promise to be more patient :)

Share this post


Link to post
Share on other sites
Simon

`add_filter( 'pagelines_post_metabar', '__return_false' );`

Share this post


Link to post
Share on other sites
djb21au

Hi Pross, Unfortunately that does the same thing as the display:none - it hides the metabar at the top but also hides the one I've added at the bottom. What I'm trying to do is remove the top metabar whilst adding it to the bottom. (BTW, I've never used filters before. Can you point to a good reference please) David

Share this post


Link to post
Share on other sites
Simon

How did you added the metabar below?

Share this post


Link to post
Share on other sites
djb21au
add_action('pagelines_loop_after_post_content','pagelines_get_post_metabar');

Added to functions.php in base

Share this post


Link to post
Share on other sites
bryan-hadaway

Try: `.post-header .metabar{display:none}` I can't imagine any reason that wouldn't work, if it doesn't please let me know where you're putting that, also please check your site through: http://jigsaw.w3.org/css-validator/ Thanks, Bryan

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  

×