Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 5 new actions to the search form, and docs #1237

Merged
merged 1 commit into from
Jun 17, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions docs/developers/hooksfilters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,19 @@ These actions are run on all homepage templates, including the Legacy Three Colu
- **largo_after_page_header** - just after the closing post <header> element
- **largo_before_page_content** - directly inside the .entry-content <div> tag
- **largo_after_page_content** - directly before the .entry-content closing <div> tag
**category.php**

**category.php**

- **largo_category_after_description_in_header** - between the ``div.archive-description`` and before ``get_template_part('partials/archive', 'category-related');``.
- **largo_before_category_river** - just before the river of stories at the bottom of the category archive page (for adding a header to this column, for example)
- **largo_after_category_river** - immediately after the river of stories at the bottom of the category archive page, after the Load More Posts button (for adding a footer to this column, for example.)

**search.php**

The Largo search page has two main modes: Google Custom Search Engine and the standard WordPress search emgine. Because the dispalyed layouts are so different, each has their own set of actions.

- **largo_search_gcs_before_container**: If Google Custom Search is enabled, fires before the GCS container
- **largo_search_gcs_after_container**: If Google Custom Search is enabled, fires after the GCS container
- **largo_search_normal_before_form**: Fires before the ouput from ``get_search_form()``
- **largo_search_normal_before_results**: Fires between ``get_search_from`` and "Your search for %s returned %s results", and runs even if there were no search results.
- **largo_search_normal_after_results**: Fires after the search results or ``partials/content-not-found`` are displayed.
45 changes: 44 additions & 1 deletion search.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@
?>
</h1>

<?
/**
* Fires before the Google Custom Search container
*
* @since Largo 0.5.5
*/
do_action('largo_search_gcs_before_container');
?>

<div class="gcs_container">
<script>
(function() {
Expand Down Expand Up @@ -57,10 +66,37 @@
</script>
<?php } ?>
</div>

<?
/**
* Fires after the Google Custom Search container
*
* @since Largo 0.5.5
*/
do_action('largo_search_gcs_after_container');
?>

<?php } else { ?>

<?php if ( have_posts() ) {
get_search_form(); ?>

/**
* Fires before the non-GCS search form
*
* @since Largo 0.5.5
*/
do_action('largo_search_normal_before_form');

get_search_form();

/**
* Fires after the non-GCS search form, before the search results counter
*
* @since Largo 0.5.5
*/
do_action('largo_search_normal_before_results');

?>

<h3 class="recent-posts clearfix">
<?php
Expand All @@ -79,6 +115,13 @@
} else {
get_template_part( 'partials/content', 'not-found' );
}

/**
* Fires after the non-GCS search results or lack-of-results
*
* @since Largo 0.5.5
*/
do_action('largo_search_normal_after_results');
} ?>
</div><!-- #content -->

Expand Down