• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

session_start() or cookie?

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › session_start() or cookie?

This topic is: resolved

Tagged: cookie, js, php

  • This topic has 1 reply, 2 voices, and was last updated 12 years, 11 months ago by Susan.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • May 1, 2013 at 8:37 am #38747
    mathiasppc
    Member

    Any help is greatly appreciated!

    Im trying to load a script once, then use the variable $country_code a couple of times on each page. Heres the script:

    <code>

    <?php require_once(“geoip.inc”);
    $gi = geoip_open(“GeoIP.dat”,GEOIP_STANDARD);
    $country_code = geoip_country_code_by_addr($gi, $_SERVER['REMOTE_ADDR']);
    geoip_close($gi);

    </code>

    Where do I put this code in Genesis? How do I make sure that I can use the variable $country_code (without having to load the script over and over)?

    I browsed around on the net last night to come up with solutions, and I found something about using session_start() or cookies, but I can`t get it to work...

    And lastly, how will the speed of my website suffer by using PHP in posts and pages vs. JS?

    http://energyinformative.org/genesis
    June 24, 2013 at 4:44 pm #47569
    Susan
    Moderator

    Closing this topic, as it was marked as "resolved"

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)
  • The topic ‘session_start() or cookie?’ is closed to new replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2026 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble