Display Menu Navigation Label
Replace $page->post_title; with $item->title; to get the menu item’s label
Replace $page->post_title; with $item->title; to get the menu item’s label
$id_frontpage = get_option(‘page_on_front’); echo get_the_title( $id_frontpage ); If you need the ID of the page that displays posts use get_option(‘page_for_posts’).
When we call get_the_title(), then the post title is taken through the wptexturize() function via the the_title filter: add_filter( ‘the_title’, ‘wptexturize’ ); The en-dash and em-dash are replaced with /* translators: en dash */ $en_dash = _x( ‘–’, ‘en dash’ ); /* translators: em dash */ $em_dash = _x( ‘—’, ’em dash’ ); A simple … Read more
Perhaps when you removed your a tag you also remove the nested the_title(); function? the_title(); is the WordPress function which spits out the plain text post/page title so having that in your h1 like below should get you the results you’re expecting. Of course there may also be some CSS which is affected due to … Read more
I don’t see a filter in wp-login for the title, but it does use __() so you might be able to use the gettext filter like: add_filter(‘gettext’, ‘wpse_214367_change_login_title’, 20, 3); function wpse_214367_change_login_title( $translated_text, $untranslated_text, $domain ) { if( “Log In” == $untranslated_text ) $translated_text = “My New Title”; return $translated_text; } EDIT: Please try this … Read more
Here is your updated function solving your 2 problems : // Post title as keywords, excluded stop words function title_as_keywords( $word ) { $blacklist = array(‘this’, ‘about’, ‘that’, ‘them’); // Excluded words … $whitelist = array(‘one’, ‘man’, ‘boy’/*etc..*/); // Whitelisted words … if ( (!in_array( $word, $blacklist ) && strlen( $word ) > 3 ) … Read more
The post object is passed by reference as the second parameter of the save_post action (do_action ( ‘save_post’, int $post_ID, WP_Post $post, bool $update ). You can use this post object to get the post date and author from. You can try the following: (NOTE: The code is untested) add_action( ‘save_post’, ‘wpse_214927_alter_title’, 10, 2 ); … Read more
I think I found the solution: add_filter(‘wp_insert_post_data’,’reset_post_date’,99,2); function reset_post_date($data,$postarr) { //update post time on status change $data[‘post_date’] = $data[‘post_modified’]; $data[‘post_date_gmt’] = $data[‘post_modified_gmt’]; //also update title and add the current date to title $data[‘post_title’] = ‘Your Default Title – ‘. current_time ( ‘m-d-Y’ ); //also update the slug of the post for the URL $data[‘post_name’] = … Read more
If your provided code (as you state) is wrapping the first word of your title with the <span>tag, then the following should also wrap the third word. $words = explode( ‘ ‘, the_title( ”, ”, false ) ); $words[0] = ‘<span>’ . $words[0] . ‘</span>’; $words[2] = ‘<span>’ . $words[2] . ‘</span>’; $title = implode( … Read more
Your first function get_images_from_media_library() only returns images guid, I’d suggest to extend it by returning all image datas : function get_images_from_media_library() { $args = array( ‘post_type’ => ‘attachment’, ‘post_mime_type’ =>’image’, ‘post_status’ => ‘inherit’, ‘posts_per_page’ => 6, ‘orderby’ => ‘rand’ ); $query_images = new WP_Query( $args ); $images = array(); foreach ( $query_images->posts as $image) { … Read more