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.
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] = "~<(?:a\\s.*?</a>|[^>]+>)(*SKIP)(*FAIL)|\\b(?:\\b(" . $tag->name . ")\\b(?=[^>]*(<|$)))\\b~i"; $tag_url = get_tag_link($tag->term_id); $tag_html[$i] = '<a href="' . $tag_url …
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 <form method="POST"> <input type="hidden" name="segment" value="test"/> </form> Custom page template $segment = isset($_POST['segment']) ? $_POST['segment'] : '';
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->comment_type ) : case 'pingback' : case 'trackback' : ?> <li <?php comment_class(); ?> id="comment<?php comment_ID(); ?>"> <div class="back-link"><?php …
Wordpress tinyMCE keep adding <p> 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 <p> tags from my html codes: Javascript: <script type="text/javascript"> tinyMCE.init({force_p_newlines : false}); </script> 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 …
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 …
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 <?php /** * Template for displaying search forms in Twenty Seventeen * * @package WordPress * @subpackage Twenty_Seventeen * @since 1.0 * @version 1.0 */ ?> <?php $unique_id = …
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 > Search Appearance > Breadcrumbs under “Taxonomy to show in breadcrumbs for content types” I can set “Category” for …
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. …
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" <?php add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' ); function theme_enqueue_styles() { wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' ); …
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' => '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.
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
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->get_results("SELECT * FROM ".$wpdb->prefix."postmeta WHERE meta_key = 'prd_part_no'", ARRAY_A);
I have a text file with 100 + names, I need to import this as an attribute into WooCommerce. I’ve been searching all over for an answer but can’t figure it out. I've tried some plugins but they don't work. How can this be done? Thanks!
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 <div class="features-block-one"> <div class="icon-one"> <span class="<?php get_theme_mod('features_one_icon' ,'fa fa-bullseye');?>"> </span> </div> </div> Code in Customizer file //block one icon $wp_customize->add_setting( 'features_one_icon', array( 'default' => 'fa-fa box', 'transport' => 'postMessage', 'sanitize_callback' => 'sanitize_key', …
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 …
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 ) { ?> …
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->isSMTP(); // The hostname of the mail server $phpmailer->Host = "localhost"; // Use SMTP authentication (true|false) $phpmailer->SMTPAuth = false; // SMTP port number - likely to be 25, 465 or 587 $phpmailer->Port = "25"; // Encryption system to use - ssl or tls $phpmailer->SMTPSecure = "tls"; $phpmailer->From = "[email protected]"; $phpmailer->FromName = "XYZ"; } and …