How to output the title of the blogs home page
You can make use the queried object to return the title of the page used as blogpage You can use the following: (Require PHP 5.4+) $title = get_queried_object()->post_title; var_dump( $title );
You can make use the queried object to return the title of the page used as blogpage You can use the following: (Require PHP 5.4+) $title = get_queried_object()->post_title; var_dump( $title );
I believe that first page is your index.php, and I would guess that the code within that file is different from single.php, which is the file used by pages 2 onwards.
if (strpos($post->post_title,’string_it_needs_to_match’) === true){ echo the_content(); } to explain strpos – method of comparing strings === makes sure strings are identical
Allow me to purpose an alternative. Instead of setting the excerpt’s length for all the posts, let’s just trim it for individual posts. Shall we? For this very purpose, we can use get_the_excerpt filter. If you look at the corresponding page about this filter, you notice that the code example is using is_attachment(), which means … Read more
I’m not sure about your question, but the below code is more correct. $attr = array( ‘title’ => get_the_title(), ‘alt’ => ‘a nice view of the ocean’, ); echo sprintf( ‘<a href=”https://wordpress.stackexchange.com/questions/281220/%s”>%s</a>’, get_the_permalink(), get_the_post_thumbnail( null, ‘post-thumbnail’, $attr ) );
Yes, everything is simple, there is a standard wordpress options and settings of the SEO plugin, I’m involved in the standard settings, a vertical divider as to remove it entirely from the functions of the theme?
Don’t see add_filter result in the site front page
PHP has a function for url encoding that would probably work: urlencode( get_the_title() );
In WordPress attachments are stored as posts so you can use most of the post specific WordPress calls and functions to read/write data associated with the attachment. This applies to post meta data for an attachment as well. So in this case, since you have the post ID ( same as $attachment_id ) you can … Read more
Yes you can pass the variable in category_name. But I think it should be get_the_title() instead of the_title(). $title = get_the_title(); $args = array( ‘category_name’ => $title ); Try this. But remember category_name only accepts category slug, not category name. You can also use following method if your page title/slug are different. And I think … Read more