Skip to content

Building WordPress theme on Windows #1531

Closed

Description

@cr101

I am new to CRA and a React beginner.
I am planning to build a WordPress theme using React + Redux and the WP API. I will be using the Foxhound theme as a guide.
I currently have a WordPress website running on my local Windows 10 machine using Wampserver 3.0.8 (Apache 2.4.23, PHP 7.0.11, MySQL 5.7.15).
I am using an Apache virtual host and the WordPress website loads at mywebsite.dev

Does CRA support named URLs e.g. mywebsite.dev as opposed to localhost:3000?

Activity

  1. gaearon commented on Feb 12, 2017

    @gaearon
    Contributor

    I think you should be able to use HOST and PORT environment variables for this.
    See Advanced Configuration.

    Does this help?

  2. cr101 commented on Feb 12, 2017

    @cr101
    ContributorAuthor

    @gaearon Yes that helps. Thanks.

    The other question I have is: does anyone have any examples/tutorials of how to build only parts of a WordPress theme as a Single Page App instead of the entire website to get the full SEO benefits as discussed in this blog post?
    SEO is a challenge for all websites built as a SPA.

  3. viankakrisna commented on Feb 13, 2017

    @viankakrisna
    Contributor

    @olivia101 for SEO i think you could do a user agent switching. It's similar to what prerender.io does. But instead of an external service you could feed the bots to wordpress' own theme engine. I'm building one myself currently.

  4. gaearon commented on Feb 14, 2017

    @gaearon
    Contributor

    I’m going to close as this is not directly actionable in this repo, but feel free to continue the discussion!

  5. viankakrisna commented on Feb 14, 2017

    @viankakrisna
    Contributor

    for anyone who needs user agent switching for bots in WordPress / PHP:

    if (
        strpos($_SERVER["HTTP_USER_AGENT"], "baiduspider"] !== false ||
        strpos($_SERVER["HTTP_USER_AGENT"], "twitterbot"] !== false ||
        strpos($_SERVER["HTTP_USER_AGENT"], "facebookexternalhit"] !== false ||
        strpos($_SERVER["HTTP_USER_AGENT"], "rogerbot"] !== false ||
        strpos($_SERVER["HTTP_USER_AGENT"], "linkedinbot"] !== false ||
        strpos($_SERVER["HTTP_USER_AGENT"], "embedly"] !== false ||
        strpos($_SERVER["HTTP_USER_AGENT"], "quora link preview"] !== false ||
        strpos($_SERVER["HTTP_USER_AGENT"], "showyoubot"] !== false ||
        strpos($_SERVER["HTTP_USER_AGENT"], "outbrain"] !== false ||
        strpos($_SERVER["HTTP_USER_AGENT"], "pinterest"] !== false ||
        strpos($_SERVER["HTTP_USER_AGENT"], "slackbot"] !== false ||
        strpos($_SERVER["HTTP_USER_AGENT"], "vkShare"] !== false ||
        strpos($_SERVER["HTTP_USER_AGENT"], "W3C_Validator"] !== false ||
        strpos($_SERVER["HTTP_USER_AGENT"], "Facebot") !== false
    ) {
        //render your server rendered markup for bots
    } else {
        //render your SPA
    }
    

    put this in your theme's index.php

    reference: https://gist.github.com/thoop/8165802 and https://prerender.io/documentation/install-middleware

  6. cr101 commented on Feb 15, 2017

    @cr101
    ContributorAuthor

    @viankakrisna Thank you, I'll give that a go.

  7. locked and limited conversation to collaborators on Jan 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions