get_page_by_title with an apostrophe in variable

Title Hello world!@#$%^*(),.;:\ will work but any title you enter containing ‘ ” < > & characters won’t work because in $content variable you have escaped HTML entities so Mal’s Post becomes Mal&#8217;s Post. To bypass it you can use sanitize_title function along with get_page_by_path. function shortcode_equipment($atts, $content = null) { $path = sanitize_title($content); $equipment … Read more

Hide price & title in store thumbnail dispay? [closed]

There are a couple solutions. The solution I would recommend is to remove the actions that prints the price & title in the first place. The main reason I suggest programmatically removing the actions is because it is theme independent. These modifications should work for any theme and you don’t have to worry about CSS … Read more

Remove site name from title post

Check your theme (header.php). If it uses something like this : <title><?php wp_title( ‘|’, true, ‘right’ ); ?></title> You can use this filter : add_filter( ‘wp_title’, ‘wpse104667_wp_title’ ); function wpse104667_wp_title( $title ) { global $post; if( is_singular() && !is_front_page() && !is_home() && !is_404() && !is_tag() ) $new_title = get_the_title($post->ID) ; return $new_title; } EDIT: add … Read more

How to limit characters of the post title?

You could do this : add_action(‘publish_post’, ‘wpse_107434_title_max_char’); function wpse_107434_title_max_char() { global $post; $title = $post->post_title; if (strlen($title) >= 100 ) wp_die( “the title must be 100 characters at most” ); } You can replace strlen() with str_word_count() if you want to set a word limit instead. EDIT: ok with new details you added it seems … Read more

Filter get_the_title to remove certain characters?

The function the_title() is just a wrapper around the function get_the_title(). It’s understandably confusing that the filter the_title actually exists inside get_the_title(). So, whatever the function you’re using to actually display it, it doesn’t matter, you can filter its content by hooking into the_title

Wp query orderby ‘title’ doesn’t work

Try adding ‘suppress_filters’ => true to your query args. Maybe you have a plugin that modifies the queries. You could also check if the posts out of order (the first one) is a sticky post. Sticky posts by default skip the order queue. You can disable this by adding ‘ignore_sticky_posts’ => true to your query … Read more

How to get post category title within the loop?

The function get_the_category() returns an array of category objects. To get the name of the first category, use this: $categories = get_the_category(); $cat_name = $categories[0]->cat_name; For a list of the properties of the category object, see the documentation on get_the_category()

Get title of page from URL

WordPress has a function called url_to_postid that may work in this situation. You can try the following (untested): <?php $url = htmlspecialchars($_SERVER[‘HTTP_REFERER’]); $back_id = url_to_postid($_SERVER[‘HTTP_REFERER’]); if( $back_id > 0 ){ $back_title = get_the_title( $back_id ); echo “<a href=”https://wordpress.stackexchange.com/questions/211840/{$url}”>Go back to the {$back_title}</a>”; }

Change separators in HTML tags

It all depends on how your theme’s header.php is structured, but the most likely way is via the document_title_separator filter, as in add_filter (‘document_title_separator’, ‘wpse_set_document_title_separator’) ; function wpse_set_document_title_separator ($sep) { return (‘|’) ; }

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