• 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

Centric Pro AJAX request(s)

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 › Design Tips and Tricks › Centric Pro AJAX request(s)

This topic is: resolved

Tagged: Ajax, centric pro, link PHP files

  • This topic has 2 replies, 2 voices, and was last updated 8 years, 5 months ago by bluebird.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • January 20, 2017 at 2:32 pm #199753
    bluebird
    Member

    Hi,

    I am trying to display likes and followers via several API calls on the front page of the Centric Pro theme that I am working on. I have been somewhat successful so far, though the Twitter API requires extra PHP files which I have not been able to sync up properly.

    Here are the paths to the JS files that I have queued up successfully:

     wp_enqueue_script( 'social-counters', get_stylesheet_directory_uri() . '/js/socialCounters.js', array( 'jquery' ), '1.0.0', true );
       wp_enqueue_script( 'social-counter-functions', get_stylesheet_directory_uri() . '/js/socialCounterFunctions.js', array( 'jquery' ), '1.0.0', true );
    

    ..and here is my failed attempt to link up the associated PHP files for Twitter via functions.php:

     function link_twitter() { ?>
    	 <script>
    	 	jQuery(function($) {
    	  console.log("here");
    		$('.home').load('twitter/index.php');
    		$('.home').load('twitter/twitterAPIExchange.php');
    		alert("finished loading");
    		});
    	});
    </script>
    	 <?php }
    

    I do not see any errors in the console, but still the Twitter API does not work.

    What could I be missing?

    Thanks to anyone who can help.

    PS. This is the site that I'm working on: http://www.testing.firebugmusic.com

    http://testing.firebugmusic.com
    January 22, 2017 at 9:18 am #199788
    Victor Font
    Moderator

    You are trying to load php files into an HTML document. PHP executes on the server, not in the client. For PHP files, you have to include them in functions.php. Assuming twitter is a subdirectory of your child theme, you would only have to add this to functions.php:

    include_once( get_stylesheet_directory() . '/twitter/index.php' );
    include_once( get_stylesheet_directory() . '/twitterAPIExchange.php' );

    Regards,

    Victor
    https://victorfont.com/
    Call us toll free: 844-VIC-FONT (842-3668)
    Have you requested your free website audit yet?

    January 28, 2017 at 12:00 pm #200189
    bluebird
    Member

    D'oh!

    Thanks Victor!

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Centric Pro AJAX request(s)’ 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

© 2025 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