Change separators in HTML <title></title> tags

I'm using WP 4.7.3 and a custom template set (mh-magazine). By default, WP sets a title tag like "Page title" - "Blog title". Now all I want to achieve is to replace "-" into a pipe symbol for layout reasons. So the processed HTMl should look like: My page title | My blog title I thought that this is easy to achieve, but I see I need some help since I'm not an expert in PHP or WP.
Category: Web

how to filter upper and lower case characters in Auto tag link code?

Question: How to filter uppercase and lowercase when the word 'tag' is written in lowercase? and vice versa, how to filter the word 'tag' which is written in capital letters? Here's the code I got from a plugin that hasn't been updated in a few years. function auto_link_tags($content){ //$post_id = get_the_ID(); $post_tags = get_the_tags(); if ($post_tags) { $i = 0; foreach($post_tags as $tag) { $tags[$i] = &quot;~&lt;(?:a\\s.*?&lt;/a&gt;|[^&gt;]+&gt;)(*SKIP)(*FAIL)|\\b(?:\\b(&quot; . $tag-&gt;name . &quot;)\\b(?=[^&gt;]*(&lt;|$)))\\b~i&quot;; $tag_url = get_tag_link($tag-&gt;term_id); $tag_html[$i] = '&lt;a href=&quot;' . $tag_url …
Category: Web

How to get the value of input hidden html from text editor to custom page template?

I have 10 or more input hidden in 10 or more pages with different values in Wordpress text editor and I want to get the value using $_POST in a custom page template. How to do this? I tried to called the input hidden name in my custom page template but the value is not getting. Text editor &lt;form method="POST"&gt; &lt;input type="hidden" name="segment" value="test"/&gt; &lt;/form&gt; Custom page template $segment = isset($_POST['segment']) ? $_POST['segment'] : '';
Category: Web

Custom comments list, right depth

I created a custom comments_list() function, it works fine, the only problem is to show child comments inside the parent div. It works well with first and second depth levels but not for others. This is my code: /* ----------------------------------------------------------------------------- * Comments custom functions * -------------------------------------------------------------------------- */ //Custom comments lst function t_one_comments_list( $comment, $args, $depth ) { $GLOBALS['comment'] = $comment; switch( $comment-&gt;comment_type ) : case 'pingback' : case 'trackback' : ?&gt; &lt;li &lt;?php comment_class(); ?&gt; id="comment&lt;?php comment_ID(); ?&gt;"&gt; &lt;div class="back-link"&gt;&lt;?php …
Category: Web

Wordpress tinyMCE Keep Wrapping <p> Tags To HTML Codes When Saving

Wordpress tinyMCE keep adding &lt;p&gt; tags when I saved my custom post types in visual mode opened! I had searching for many solutions, but not working. Here is the solution that I found, but this is unable to stop wordpress from adding annoying &lt;p&gt; tags from my html codes: Javascript: &lt;script type="text/javascript"&gt; tinyMCE.init({force_p_newlines : false}); &lt;/script&gt; PHP function tinymce_remove_root_block_tag( $init ) { $init['wpautop'] = false; $init['force_p_newlines'] = false; $init['forced_root_block'] = false; return $init; } add_filter( 'tiny_mce_before_init', 'tinymce_remove_root_block_tag' ); I don't …
Category: Web

how to register / add multiple options into one field in wordpress?

How can I register or add multiple options into one field. For example, we save a logo in get_options() by registering the setting and adding fields by add_settings_field() function and we output it accordingly. But what if we want to save multiple options into one field, like we have an option on our page called "Select your favourite colour" and there are check-boxes with different colours and user needs to select multiple colours (not a single colour) then how would …
Category: Web

WP Search Form Query: Add Author's posts into search query

As the title suggests, I'm looking for WordPress advice relative to leveraging the standard searchform.php functionality to additionally query the author field when performing searches. I've tried various different means to do this without any success, and so I'm coming to quite the headache. Below are the template files used: searchform.php &lt;?php /** * Template for displaying search forms in Twenty Seventeen * * @package WordPress * @subpackage Twenty_Seventeen * @since 1.0 * @version 1.0 */ ?&gt; &lt;?php $unique_id = …
Category: Web

Link breadcrumbs to actual page – not the category archive

Status quo: the breadcrumbs show the following structure: home/parent-category/sub-category/post And click on parent-category or sub-category links to the default archive pages. This is also the correct hierarchy based on our navigation menu. So in the example above it is home/parent-page/sub-page/post. We want the breadcrumbs link to the actual page and not to the archive page of the category. In the Yoast-Settings &gt; Search Appearance &gt; Breadcrumbs under “Taxonomy to show in breadcrumbs for content types” I can set “Category” for …
Category: Web

creating a custom post template

I want to customize my individual posts. I have an example of what I'm trying to achieve below. Would I make a custom post template for this? If so how would I do this? Or should I add to my single.php? Thanks in advance. What I want my individual post pages to look like. I want two pictures side by side that are the full width of the page. Text. One picture that is the full width of the page. …
Category: Web

Background image not appearing

I'm trying to add a custom background on a child theme. In the child theme's functions.php, I add add_theme_support( 'custom-background'); and the background option appears under the "Appearance" menu as expected. I add the image that I want, save, and nothing happens. The image won't appear as the background. What am I doing wrong? Using version 4.3.1. This is all that's in my child theme's function.php" &lt;?php add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' ); function theme_enqueue_styles() { wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' ); …
Category: Web

Shortcode displays only default attribute values

For some reasons every shortcode, that I try to add to functions.php, displays only default attribute value and ignores what I specify in a post. E.g.: function my_shortcode( $atts ) { extract( shortcode_atts( array( 'id' =&gt; '18', ), $atts ) ); return $id; } add_shortcode( 'sc', 'my_shortcode' ); So I use shortcode [sc id="81"] and expect echoing 81 but I get 18. BTW I use child theme, and latest version of wordpress. I'm really stuck. Thanks for any help.
Category: Web

str_replace inside specific css files

Is it possible to perform str_replace inside an enqueue stylesheet? i can do str_replace on inline style with this function function replace_text($text) { $text = str_replace('background-image', 'background', $text); return $text; } add_filter('the_content', 'replace_text'); is it possible to perform the same action inside style.css file ? wp-content/plugins/assets/style.css
Category: Web

How to get meta data from custom category name

I want to get meta data by custom post type category name. Right now i am getting all meta data but i want specific for each category $partSql = $wpdb-&gt;get_results("SELECT * FROM ".$wpdb-&gt;prefix."postmeta WHERE meta_key = 'prd_part_no'", ARRAY_A);
Category: Web

WordPress Customizer Help with FontAwesome Icon

Here's the scenario - I want to select fontawesome icons from the dropdown list but it's not working. For some reason the class inside span is not adding up (I have tried jQuery().append(), CSS) but so far no luck. ANY help would be appreciated. Code in Page.php file &lt;div class="features-block-one"&gt; &lt;div class="icon-one"&gt; &lt;span class="&lt;?php get_theme_mod('features_one_icon' ,'fa fa-bullseye');?&gt;"&gt; &lt;/span&gt; &lt;/div&gt; &lt;/div&gt; Code in Customizer file //block one icon $wp_customize-&gt;add_setting( 'features_one_icon', array( 'default' =&gt; 'fa-fa box', 'transport' =&gt; 'postMessage', 'sanitize_callback' =&gt; 'sanitize_key', …
Category: Web

Url rewriting on custom post with CPT UI plugin

I checked all subjects in forum about this but i didn't found way to resolve my problem. sorry for my english, i'm french.. :) So.. i got a custom post listing ( with template listing pro ) there : http://easycowork.fr/bureau/easy-office-lille/ I created a custom post named service and i display all service associate on listing on the listing single page. When i click on a service, i display his data on the same page with a GET parameter ( the …
Category: Web

Create membership number for existing/new users

I have a membership site with 4000+ users currently on it. I am needing to give both new/existing users an automatic ID number. its very similar to this: Create Unique ID for user However, this only works for new users, I need it to work for the current users too. So for instance, user id 3421 would get membership number 3421. This is what I have so far: (pretty much all from above link) function fb_add_custom_user_profile_fields( $user ) { ?&gt; …
Category: Web

How to send email with wp_mail() with from email taken from contact form instead of the host?

I have set up SMTL like this, add_action( "phpmailer_init", "send_smtp_email" ); function send_smtp_email( $phpmailer ) { ini_set("sendmail_from","[email protected]"); ini_set("sendmail_path","[email protected]"); // Define that we are sending with SMTP $phpmailer-&gt;isSMTP(); // The hostname of the mail server $phpmailer-&gt;Host = "localhost"; // Use SMTP authentication (true|false) $phpmailer-&gt;SMTPAuth = false; // SMTP port number - likely to be 25, 465 or 587 $phpmailer-&gt;Port = "25"; // Encryption system to use - ssl or tls $phpmailer-&gt;SMTPSecure = "tls"; $phpmailer-&gt;From = "[email protected]"; $phpmailer-&gt;FromName = "XYZ"; } and …
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.