Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm trying to set the cookie to my site to hide a div on click action. Description of the problem.

  1. I wanna set the cookie for the whole site not for particular page. I'm setting the cookie on click the div by

jquery-cookie.js

  1. when I'm clicking the div on home page the div is invisible throughout the site. but if I'm trying to remove my div on other page it is not invisible throughout the site.

  2. I've tried the following functions of the wordpress codex

site_url() get_site_url() home_url() get_option('home')

by these methods I've named the domain but it is not working. I've also tried / for the domain name it is also not working. these all are not working for me. please suggest me some other method to do that.

My plugin site consist of 4 pages

url as follows

site/wordpress/
site/wordpress/contact-us-2/
site/wordpress/sample-page/
site/wordpress/test-page/
share|improve this question

1 Answer 1

up vote 0 down vote accepted

in domain Name I've used this

$urlOfSite =  get_option('home');
$url = parse_url($urlOfSite, PHP_URL_PATH);

url path . This is working for me .

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.