Jump to content


Photo
- - - - -

Hooks in the Framework


  • Please log in to reply
3 replies to this topic

#1 onlinetracker

onlinetracker

    Super Member

  • Members

  • 154 posts
  • Country: Country Flag

Posted 13 July 2013 - 02:36 AM

I'm trying to address this issue that exists for awhile and I'm trying not to reinvent or modify the wheel too much. Here is the situation.

 

Here is the situation. You can do this too and I would like to submit this as an idea to add to Pagelines but I don't know if I'm the only one that would want this.

 

When you go into the control panel for Pagelines -> Site Options -> Blog and Posts, then scroll down to the "Post Excerpt or Summary Handling" section, you can disable these functions like "Posts/Blog Page excerpts.

 

When I do that on any install, it removes the hooks from processing and from remaining in the process/display of the page. Essentially, that removes any functions you throw in Functions.php that refer to excerpts such as before_excerpt and after_excerpt.

 

I think it would be great if those hooks were to remain functional even after disabling the function. That way you can continue to use the hooks without displaying an excerpt.

 

I understand there are other solutions, but perhaps its a feature that people can utilize and make development life easier by default.

 

What do you think?

 

ps... if this belongs somewhere else, let me know, or if you can, go ahead and move it.



#2 Rob

Rob

    One Smart Egg

  • Members
  • 13575 posts
  • LocationEast Coast, USA
  • Framework Version:The Latest, of course
  • Country: Country Flag

Posted 13 July 2013 - 02:44 PM

Hi,

 

I just want to clarify....

 

You are saying that if you have any hooks in the plugin pagelines-customize/functions.php, a child theme or in Hooker (plugin) and you change the settings for post excerpt handling in Dashboard > PageLines > Site Options > Blog And Posts, the hooks (no matter what they are), are made iinactive?

 

I know that changing settings in Site Options will overwrite functions added incorrectly to the functions.php in the site, as it is overwritten to deal with the settings.  But what you seem to be describing has never been reported previously.   Please confirm my understanding is correct.



#3 onlinetracker

onlinetracker

    Super Member

  • Members

  • 154 posts
  • Country: Country Flag

Posted 13 July 2013 - 06:27 PM

Hi,

 

I just want to clarify....

 

You are saying that if you have any hooks in the plugin pagelines-customize/functions.php, a child theme or in Hooker (plugin) and you change the settings for post excerpt handling in Dashboard > PageLines > Site Options > Blog And Posts, the hooks (no matter what they are), are made iinactive?

 

I know that changing settings in Site Options will overwrite functions added incorrectly to the functions.php in the site, as it is overwritten to deal with the settings.  But what you seem to be describing has never been reported previously.   Please confirm my understanding is correct.

 

 

I'm not sure about the "no matter what they are" aspect, but if I put a fuction in functions.php and it is supposed to run off the hook for "pagelines_loop_after_excerpt" or "pagelines_loop_before_excerpt", it all goes away the moment I turn off excerpts from the Blog&Posts section of the Pagelines console. Yep.

 

As for the "added incorrectly" part, I may not know right from wrong if this is wrong, let me know...

 

This is in my Pagelines Customize Functions.php file:

 

add_action('pagelines_loop_after_excerpt','my_related_posts');
    function my_related_posts() {

if ( function_exists('related_posts') ) { related_posts(); }
 }



#4 Rob

Rob

    One Smart Egg

  • Members
  • 13575 posts
  • LocationEast Coast, USA
  • Framework Version:The Latest, of course
  • Country: Country Flag

Posted 13 July 2013 - 06:49 PM

I'm sorry if I wasn't clear. I meant that if you use functions.php directly in the wp-content/themes/pagelines folder, that would be incorrect.  It will be that particular functions.php which is overwritten.  The ones in PageLines Customize, child themes or are not overwritten, and Hooker writes directly to the database.

 

Unfortunately, I'm not a programmer, so I don't know if your hook is correctly written, but you have it in the correct file.