Is it possible to create 2 unique titles for an Events custom post type: Upcoming Events and Past Events?

Try this: in archive-header.php line 8 – 10 by interecepting the variable “period=past” or ( I guess) “period = future” of current URL <?php else : if( !empty($_GET[‘period’] ) && $_GET[‘period’] == ‘past’) { echo “Past Events”; } elseif( !empty($_GET[‘period’] ) && $_GET[‘period’] == ‘future’ /*or whatever*/){ echo “Upcoming Events”; } else{ echo esc_html(lsvr_pressville_get_event_archive_title());//the default … Read more

Display text if title in archive has specific word

You may use string comparison. I could illustrate a simple example code. It is assumed that the user with the following knowledge/experience PHP – understand what is variables, static value WordPress templates and how to modify them There are many ways to test string such as php string comparison strpos() (simple) php regular expression preg_match() … Read more

Modify WordPress Page Title ()

It’s important to read the documentation for filters. The documentation for pre_get_document_title says (emphasis mine): Filters the document title before it is generated. and $title (string) The document title. Default empty string. So when using pre_get_document_title, the title has not been set yet, so when you do this: return $title . ‘ new title’; $title … Read more

Changing Title Tag on Shop Archive Page (current solution reverting to Title of First Product in Loop)

Seems like the solution I was looking for was !in_the_loop() Full: add_filter( ‘the_title’, ‘custom_account_endpoint_titles’, 10, 2 ); function custom_account_endpoint_titles( $title ) { if (is_shop() && !in_the_loop() && ! is_admin() && ( ! defined( ‘DOING_AJAX’ ) || ! DOING_AJAX )) { return ‘Shop – Parure.co’; } } Note: the !is_admin and !DOING_AJAX functions are to prevent … Read more

Replace post title based on conditions

You can use the_title filter to modify the post_title prior to printing on the screen. add_filter(“the_title”, function($title, $id)){ $user = wp_get_current_user(); if((!is_user_logged_in() || in_array(“pending”, $user->roles)) && “post” === get_post_type($id)){ $title = “Custom title”; } return $title; }, 10, 2); source: https://developer.wordpress.org/reference/hooks/the_title/

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)