10 September 2019

How to get wordpress site title name from url ?

get wordpress site title name from url 

<?php

// Exit if accessed directly
if ( !defined( 'ABSPATH' ) ) exit;


function oops_script(){

wp_enqueue_style("oops-style", plugin_dir_url(__FILE__)."style.css");

}
add_action("wp_enqueue_scripts","oops_script");



/*+++++++ Declaring Global Variables +++++++++*/
$domain = site_url(); //or home
$domain = str_replace('http://', '', $domain);
$domain = str_replace('www', '', $domain);
$domain = str_replace('.com', '', $domain);
$domain = str_replace('/', '', $domain);
$domain = str_replace('localhost', '', $domain);

 $wpsite = $domain;


?>

use it in another page with global variable


<?php



global $wpsite;

echo $wpsite ;



?>

No comments:

Post a Comment

How to create youtube videos slider with play and pause option in wordpress?

Create youtube videos slider with play and pause option in wordpress youtube videos slider Use this shortcode:- [punjab_today] function my_...