• Resolved danny1245

    (@danny1245)


    Hey guys!

    We recently implemented a stock quote system, where a user can enter a stock symbol and it will return all sorts of financial values.

    I have a template made up that displays the financial widgets, and when a user enters a ticker symbol it runs some JS with the callback url being my template. In this example, it is

    What my issue is, is the title is currently blank. When a user inputs a symbol, the page title in the browser is simply “Quote -” Instead, I want it to be “Quote – XXXX” with XXXX being the stock ticker they entered.

    What is the easiest way to go about this? I know it’s probably really simple, but I am stumped.

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Please try this code. Hopefully, it will help you

    add_filter( 'wp_title', 'ps_wp_title_quote' );
    function ps_wp_title_quote( $title )
    {
    	if(isset($_GET['qm_symbol'])){
    		$qm_symbol = $_GET['qm_symbol'];
    	}
        if (is_page('quote') ) {
    	       $title = __( 'Quote', 'textdomain' ) . ' - ' . $qm_symbol;
        }
        return $title;
    }

    .

    Thread Starter danny1245

    (@danny1245)

    Couldn’t get this to work. Whereabouts would I be placing this? I tried the page template, and functions.php

    Thread Starter danny1245

    (@danny1245)

    Finally got it to work! One issue though, the tab in the browser still just says “Quote -“. Any way to fix this?

    This is https://prnt.sc/k12rrm from where the browser title came. You need to find it in your header file and have to wrap it in the condition.

    <title><?php if(isset($_GET['qm_symbol'])){
    		$qm_symbol = $_GET['qm_symbol'];
    	}
        if (is_page('quote') ) {
    	      echo 'Quote - '.$qm_symbol;
        }else{
    wp_title();
    }
    ?></title>

    Please resolve if it worked for you.

    Thread Starter danny1245

    (@danny1245)

    Worked! Thank you man!

    • This reply was modified 6 years, 8 months ago by danny1245.
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Post Title With Paramater’ is closed to new replies.