cody.me
Forum Replies Created
-
Forum: Plugins
In reply to: [WordPress Infinite Scroll - Ajax Load More] Sticky PostsJust to add to tobiasmalikowski’s code:
You could also do it with exclude=”‘.$sticky.'”
post__not_in=’ . $sticky . ‘] didn’t work for me so I used exclude ??Forum: Plugins
In reply to: [Media File Manager] Conflict with Yoast SEO and BuildersI have the exact same issue. Conflict between Media File Manager Advanced, Yoast SEO premium, and Shortcodes ultimate plugins
I figured out that Yoast SEO and Shortcodes ultimate javascript are conflicting. Please advise how to resolve
Forum: Networking WordPress
In reply to: $_SERVER['HTTP_REFERER'] and wordpress multisiteI appreciate your help, Marios.
I finally found a solution. Because I spent a long time thinking about this problem, I thought to write a summary of what I found here so that others might find it useful too.
- Cookies and PHP $_SESSION variables are used by many plugins and themes for WordPress. While WP Engine doesn’t currently prevent cookies or sessions, they may not work as you expect on their servers.
- WP Engine implements Page caching as a primary method of speeding up the sites that they host.
- Cookies can still be used with page caching. However, they need to be handled predominantly with Javascript instead of PHP. If you try to use PHP to read cookies, it will likely only display an empty cookie array.
So basically because of WpEngine cashing, your PHP code will not run. Use Javascript to make sure your content gets updated every time a user loads the page.
Here are some useful links to refer to:
Forum: Networking WordPress
In reply to: $_SERVER['HTTP_REFERER'] and wordpress multisiteThanks, Marios. I tried that too… None of my echo statements get printed either… It is really weird…
I also tried storing the http referrer value in a cookie:
if(isset($_SERVER['HTTP_REFERER'])) { setcookie("refererWebsite", $_SERVER['HTTP_REFERER'], time()+3600); } if (isset($_COOKIE['refererWebsite'])) { echo $_COOKIE['refererWebsite']; }
Again it works on the local site but not on the live one… it won’t print the echo statement, and won’t even list it in the cookies list on chrome dev tool.
Do you think it might have something to do with my hosting company? I am using WPEngine
Forum: Networking WordPress
In reply to: $_SERVER['HTTP_REFERER'] and wordpress multisiteSo I test my local website this way:
1. Search for a random word (say “test”) for example in Google
2. In the search results page, I right click (inspect element) on the title of the first search result list item and change its link to https://localhost. So when I click on that title, it takes me to my local site and saves the referrer as google.comMy code looks like this:
$referrerSites = array("www.google.com", "www.yahoo.com", "www.bing.com"); if(isset($_SERVER['HTTP_REFERER'])) { $ref = $_SERVER['HTTP_REFERER']; foreach ($referrerSites as $site) { if (strpos(strtolower($ref), $site) !== false) { //do things here... } } }
The referrer gets set on the local, but not on the live website…