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
Post Type Archive options meta box #20
Comments
Status update... Title output: Outdated filter example/**
* 404 title filter.
* @since 2.5.2
*/
add_filter( 'the_seo_framework_404_title', 'my_404_title' );
function my_404_title( $default = '404' ); {
//* Will be escaped on output.
return 'four oh four';
}
/**
* Search title filter.
* @since 2.6.0
* @note The default title can be translated.
*/
add_filter( 'the_seo_framework_search_title', 'my_search_title' );
function my_search_title( $default_i18n ='Search results for:' ) {
//* Will be escaped on output.
return 'Custom Search:';
} Description output: Facebook generates its own description from the content (like Google does) on pages without any description present. Plausible resolutions:
Other output: Plausible resolution on 404: Transient cache for the whole 404 output. I do not believe that there's any interest in any other output apart from the title and description. |
From Eusebiu's suggestions: This metabox could be added to the SEO Settings page (or a new tab) with a default (or stripped) SEO metabox. |
Here are filters which you can use before this is implemented. Filter placeholder example: (click me)/**
* Filters the raw titles generated by The SEO Framework for non-queryable pages.
*
* Doesn't require escaping.
*
* @param string $title The filter title.
* @param array|null $args The query arguments. Accepts 'id' and 'taxonomy'.
* Is null to autodetermine query.
* @return string The raw generated title output.
*/
add_filter( 'the_seo_framework_title_from_generation', function( $title, $query ) {
// We don't want to filter predefined queries. This will conflict in breadcrumbs otherwise.
if ( null === $query ) return $title;
$tsf = \the_seo_framework();
if ( $tsf->is_404() ) {
// Overwrite 404 title here. Default is shown.
$title = $tsf->get_static_404_title();
} elseif ( $tsf->is_search() ) {
// Overwrite search title here. Default is shown.
$title = $tsf->get_generated_search_query_title();
} elseif ( $tsf->is_real_front_page() ) {
// Overwrite front page title here. Default is shown.
$title = $tsf->get_static_front_page_title();
} elseif ( $tsf->is_archive() ) {
// Overwrite archive page titles here. Default is shown.
$title = $tsf->get_generated_archive_title();
} elseif ( $tsf->is_singular() ) {
// Overwrite singular page titles here. Default is shown.
$title = $tsf->get_generated_single_post_title();
}
return $title;
}, 10, 2 ); Real world example: (click me)/**
* Filters the raw titles generated by The SEO Framework for non-queryable pages.
*
* Doesn't require escaping.
*
* @param string $title The filter title.
* @param array|null $args The query arguments. Accepts 'id' and 'taxonomy'.
* Is null to autodetermine query.
* @return string The raw generated title output.
*/
add_filter( 'the_seo_framework_title_from_generation', function( $title, $query ) {
// We don't want to filter predefined queries. This will conflict in breadcrumbs otherwise.
if ( null === $query ) return $title;
$tsf = \the_seo_framework();
if ( $tsf->is_404() ) {
// Overwrite 404 title here.
$title = '404 Not Found';
} elseif ( $tsf->is_search() ) {
// Overwrite search title here. Visitor-fed variable, best to pre-escape.
$title = sprintf( 'Search: “%s”', \get_search_query() );
} elseif ( $tsf->is_real_front_page() ) {
// Use default title.
} elseif ( $tsf->is_archive() ) {
if ( is_post_type_archive( 'product' ) ) {
$title = 'Product overview';
} else {
// Use default title.
}
} elseif ( $tsf->is_singular() ) {
// Use default title.
}
return $title;
}, 10, 2 ); |
I punted this to 3.4.0. I must send out 3.3.0 sooner. |
I also am waiting for titles+descriptions+robots for Custom Post Types and Custom Post types archive pages. But I am also missing the same for Custom Taxonomies. Like in Yoast. My sites often rely heavily on CPTs and Custom Taxonomies. Currently the absense of default CPT, CPT archive and Tax term title/meta/settings is the only thing holding me back to move from Yoast to TSF for larger sites. |
Any news on this?
|
This comment has been minimized.
This comment has been minimized.
Pushed to 4.2.0, because we need an update out quickly to support the new Core sitemap functionality (WP 5.5), due August 2020. |
This comment has been minimized.
This comment has been minimized.
Addresses #508 (comment) Addresses #20 (comment). Fixed some grammar in the comments. Updated some sentences for clarity. Updated DB version, added migration to new taxonomical options (and a downgrade fallback).
From my comment above
I'm considering dropping non-JS support altogether, much as WordPress Core has with the Gutenberg (Block Editor) project. Dropping non-JS allows me to offload processing to the browser instead of redundantly pre-processing on the server. I have already dropped most of the title and description pre-processing. The image below shows how the Post SEO Settings meta box looks with JS disabled (in 4.2.0-dev-39). Open Graph and Twitter titles still have redundantly prefilled titles, but the JS overrides that, anyway. Ultimately, dropping support shrinks the codebase and increases maintainability. I'll try to make this feature non-JS capable, but I'll forgo that effort at the earliest inconvenience. |
In TSF v4.0.0 (Sep 2019), I brought term support: On the term-edit screens, you can edit the title, description, robots, canonical URL, redirect, and social meta. In TSF v4.1.0 (Aug 2020), I brought support for taxonomies: All taxonomies have global robots (noindex/nofollow/noarchive) settings. In TSF v4.2.0 (ETA Nov 2021), I'll bring Post Type Archive (PTA) settings. Planned, I'll include all options terms have. Akin to what WordPress calls those internally, the meta-box will be named "Post Type Archive Settings." Even though that's not a name used colloquially among WordPress users to refer to these types of pages — they call it "Archives" — I prefer my own sanity. TSF will store the data with all other settings within The SEO Framework's primary Key-Value Store ( The "Blog" page is a page — as such, it already has (most of) these settings available. If the blog page is the home page, then the homepage settings meta box should already be sufficient. |
Still requires documentation and cleanup.
Also improved performance by nooping description processing on empty archives.
Attached is a preview of how the box will appear. no-JS support works well, too. Description, social input, and robots listeners still need to be implemented. Commits will follow in the next few days. |
Please oh please can we get this put in pronto! EDIT: Sorry, reading this a bit more it looks like this is really going to happen soon. I wish you could see the smile on my face at the moment! Thank you, Thank you, Thank you, Thank you! |
In a30f46a, I added the final piece of this puzzle: "What would happen when the post type is disabled?" Well, this: I thought about disabling the select-option and adding a hint, but common HTML select-styling wouldn't allow me to convey why it was disabled. So, I opted for removing the editor and putting in place a warning message. This feature took 14 days, 140 hours, 15 commits, and 100 file changes to complete. You can view the timeline here: 64b64e2...0ae8fc3. I think that'll make for a nice feature-packed 4.2.0 update. So, I'll punt most (all?) other items from the milestone. A complete code review will still occur, for I found a few bugs in need of resolving. As always, I'll test the update on my networks to find errors spawn and review changes in Google Search Console et al. Fun fact: If you hit space in a Post Type Archive's title with Archive Title Prefixes enabled (under Title Settings), you'll find two floating titles. This feature was developed a couple of years back but never utilized (and I honestly forgot I coded it). The behavior is intentional, for your space will be removed on-save anyway. I consider it a bug that Terms (Category/Tags) do not behave the same. |
Hi, |
Hi @bonakor, This feature works with any registered Post Type Archive. Please open a support topic and share the code you used to register the custom taxonomy so we can investigate the issue: https://tsf.fyi/support/tsf/new-topic. |
Addresses sybrew/the-seo-framework#508 (comment) Addresses sybrew/the-seo-framework#20 (comment). Fixed some grammar in the comments. Updated some sentences for clarity. Updated DB version, added migration to new taxonomical options (and a downgrade fallback).
From: Eelco's plugin review
New feature for options that allow custom titles and descriptions for non-editable query types, like 404 and search.
The text was updated successfully, but these errors were encountered: