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 a case for the generic post_type in archive.php #1232

Merged
merged 3 commits into from
Jun 11, 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
20 changes: 16 additions & 4 deletions archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,26 @@
} else {
$title = _e( 'Blog Archives', 'largo' );
}
} elseif ( is_post_type_archive( 'rounduplink' ) ) {
} elseif ( is_post_type_archive() ) {
$post_type = $wp_query->query_vars['post_type'];
/**
* Make the title of the rounduplink archive filterable
* Make the title of the post_type archive filterable
* @param string $title The title of the archive page
* @since 0.5.4
*/
$title = apply_filters( 'largo_archive_rounduplink_title', __( 'Saved Links' , 'largo' ) );
$rss_link = '/rounduplink/feed';
$title = apply_filters(
'largo_archive_' . $post_type . '_title',
__( post_type_archive_title( '', false ), 'largo' )
);
/**
* Make the feed url of the post_type archive filterable
* @param string $title The title of the archive page
* @since 0.5.5
*/
$rss_link = apply_filters(
'largo_archive_' . $post_type . '_feed',
site_url('/feed/?post_type=' . urlencode($post_type))
);
}
?>

Expand Down
18 changes: 15 additions & 3 deletions docs/developers/hooksfilters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,29 @@ filter: **largo_homepage_topstories_post_count**
Other filters and actions
-------------------------

filter: **largo_archive_rounduplink_title**
filter: **largo_archive_{$post_type}_title**

Called in `archive.php` to filter the page title for posts in the `rounduplink` post type.
Called in `archive.php` to filter the page title for posts in the ``$post_type`` `post type <https://codex.wordpress.org/Post_Types>`_.

**Usage:** ::

function filter_rounduplink_title($title) {
return "Custom title here";
return __("Custom title here", 'largo');
}
add_action('largo_archive_rounduplink_title', 'filter_rounduplink_title');

filter: **largo_archive_{$post_type}_feed**

Called in `archive.php` to filter the feed url for posts in the ``$post_type`` `post type <https://codex.wordpress.org/Post_Types>`_.
post type.

**Usage:** ::

function filter_column_feed($title) {
return "http://example.com/custom_feed_url/feed.xml";
}
add_action('largo_archive_column_feed', 'filter_column_feed');

filter: **largo_registration_extra_fields**

Called directly before the `[largo_registration_form]` shortcode has finished executing. You can append to this any addition form fields that you want to process.
Expand Down