Forum Replies Created

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter gulliwog

    (@gulliwog)

    Tyvm for the reply. The reason the scripts are “throwing errors” is because, for example, on my home page I have an element with the ID #my_cool_svg, which I animate using javascript… but that element ONLY appears on my homepage, so when I am on my Contact page if the script is trying to add classes to #my_cool_svg, it won’t exist and I will get an “undefined” error in console.

    This is where my inexperience in js comes through, I am not sure which is the best way to manage that. Like I said in my original post, I have simply added a condition before calling functions, e.g. if($my_target_svg.length){ // call my function}.

    From what you are saying it sounds like it is better maybe to add conditions and leave all my scripts in one .min file rather than separate them out into different files. I am just asking what normal to do in this situation, I sure lots of sites run scripts which are only used or necessary on certain pages… whats the usual strategy?

    I used more or less the method in your first link to enqueue scripts but using wordpress page templates as the condition :

    if(is_page()){ //Check if we are viewing a page
    global $wp_query;
    $template_name = get_post_meta( $wp_query->post->ID, ‘_wp_page_template’, true );
    if($template_name == ‘my-page-template.php’)… etc.

    I try to avoid using plugins for anything I am able to achieve myself so as not to bloat my site too much… I am already using quite a bloated theme and I don’t like loading the site down with more crap.

    Thanks again for the answer.

    Thread Starter gulliwog

    (@gulliwog)

    But it doesn’t have also to be the static front-page? I would like to have a different static frontpage to the blog page.

    “There is no conditional tag for the blog page. You have to use both is_home() and is_front_page() to detect this page”

    Is that saying I can only change template if it is both?

    Thread Starter gulliwog

    (@gulliwog)

    Thank you for the info… but why can’t I get any of this info in my profile?! Logic would dictate that with only one setting to say whether or not you want to get email notifications that would override the subscribe function… otherwise what else are you saying you don’t want to be notified about?!

    I have to be honest the level of user settings and user help on this site are really not very good. I don’t think the forums should be being clogged up with posts like this one, but with no help section there is no other choice.

    It’s somewhat ironic that a site dedicated to helping others build better, more user-friendly sites should not be very user friendly itself!!

    Thread Starter gulliwog

    (@gulliwog)

    Thanks for such a detailed explanation Clicks, I really appreciate it. I think I made life more complicated than necessary for myself by not turning localhost into localhost.com. I kept it as a localhost running htdocs as subserver domains, then within httpd-hosts I created virtual servers for each of the real IPs I would be using mysite.com fr.mysite.com mysite.fr and so on and redirected with hosts. Now however, when I transfer the site live I will not have to change any of the paths or urls within WP. Now when I type locally myrealurl.com I get to my WP. Theoretically all I will have to do is upload WP, tell my webhost to point all my urls at the install folder and it will work.

    After a lot of trying different things I eventually figured out why it wasn’t finding my site after installing the WPMS!!! The WP warning tells you to remove the www. from in front of the site’s url, but it said nothing about the WP install url, so I was changing only the site url.

    My WP install path was:
    https://www.mysite.example
    But my site URL path was :
    https://mysite.example

    That is kind of what the WP instructions made me think was correct to do. Eventually I tried changing BOTH the WP path and URL path to https://mysite.example and when I did it started working normally. I assume because when they are different the one with www. takes precedence or something so it jumps to the WP install rather than the site. Changing them both seems to make it work fine now.

    After two days fiddling, testing, reading tuts and pulling out hair it seems to be okay. The WP side isn’t so difficult, it’s more sorting out and understanding all the hosting, server redirects etc. stuff.

    I was also starting out with the misconception that each WPMS site would have it’s own specific path somehow (and index.php) I didn’t realize you just pointed everything at the same location and let WP sort it out from there. It’s one of those simple details but when it doesn’t get said in directly it can leave you thinking in totally the wrong terms.

    Thanks again for the help!! I was really starting to lose it at 5am yesterday!! It all seems to work now, it finds the pages it should when it should. I have managed to get it working twice now with two test setups and in the second one I even added in the domain mapping for the subsite. So I assume the fact it works means it’s correct… even if in a roundabout sort of way and that I won’t run into problems later down the line. Take care, bro.

    • This reply was modified 7 years, 3 months ago by gulliwog.
    Thread Starter gulliwog

    (@gulliwog)

    UPDATE : I think I finally have the mutlisite working correctly locally! I think

    What I dont get yet is why when I try to view my primary site it sends me to https://www.mysite.com/wp-signup.php?new=mysite.com. How do I just view/work on primary site normally?

    I created the same XAMPP redirects above for french.mysite.com and german.mysite.com and pointed them all at the same DocumentRoot (“C:/xampp/htdocs/mysite/www/”) and added them to localhost. That meant I could create subdomains and switch between my different dashboards.

    I then also added https://www.mysite.de and https://www.mysite.fr to XAMPP setting the same document root as before, and finally went into settings -> Domains and told the subdomains french.mysite.com and german.mysite.com to use https://www.mysite.fr and https://www.mysite.de. Now it seems to work because when I tap https://www.mysite.fr into the address bar it does find the correct site… but I am not convinced that I have done this 100% correctly… the domain mapping in settings I didn’t actually touch at all.

    My parent site, the .com english version, where the wordpress is installed already uses the correct domain i.e https://www.mysite.com – it’s only the sub-domain sites I need to redirect. The “domain mapping” in settings seems to be a global setting for the parent site, not redirects for the subdomains. So maybe I dont need to touch this? I am still a little confused. ??

    • This reply was modified 7 years, 3 months ago by gulliwog.
    • This reply was modified 7 years, 3 months ago by gulliwog.
    Thread Starter gulliwog

    (@gulliwog)

    Thanks for all the help Clicks!! To keep sites separate I want to use subdomains rather than subfolders.

    I was actually just reading though that same article you linked… it’s very clear but there is one thing is doesn’t cover. Like I said in last post, using XAMPP I have to add

    <VirtualHost *:80>
    DocumentRoot “C:/xampp/htdocs/mysite/www/”
    ServerName mysite.com
    ServerAlias https://www.mysite.com
    <Directory “C:/xampp/htdocs/mysite/www/>
    Order allow,deny
    Allow from all
    </Directory>
    </VirtualHost>

    to get server working on localhost. But don’t I have to do the same kind of thing for each subdomain? With the above rule I can install multisite and I can create subdomains like french.mysite.com and german.mysite.com but when I try to open these I get “page not found” and I assume it’s because I haven’t told XAMPP where to redirect those subdomains to… but WHERE do they redirect to?! Surely each subdomain must have its own unique path and directory. No tutorial I have found explains this adequately in full, and trying to stitch info together from different sources is very confusing. This is so depressing. ??

    Thread Starter gulliwog

    (@gulliwog)

    I am not trying to redirect the live site to the local. I simply want set things up locally to allow me to develop my 3 sites (like you said). I don’t have to do the final domain mapping at this stage I guess, but I wanted to make sure that I understood how it worked and that I could get it to work when transferred to the live site… and I thought it would be easier if mimicked the live setup as closely as possible locally for development.

    Thus far I haven’t even been able to figure out how to correctly setup the local Multisite without domain mapping. I can get the basic parent site working with a local server by adding:
    To localhosts:

    127.0.0.1 mysite.com
    127.0.0.1 https://www.mysite.com

    To apache cfg:

    <VirtualHost *:80>
    DocumentRoot “C:/xampp/htdocs/mysite/www/”
    ServerName mysite.com
    ServerAlias https://www.mysite.com
    <Directory “C:/xampp/htdocs/mysite/www/>
    Order allow,deny
    Allow from all
    </Directory>
    </VirtualHost>

    But how do I get the subdomains to work? From my main site I can make french.mysite.com german.mysite.com but I cannot edit them because I don’t know how to define them correctly locally, they just show up as page not available.

    Maybe I can leave the final mapping of french.mysite.com to mysite.fr until I post the site live, but tbh as I have never done this before I wanted to try to get it all working as it should locally rather than do a ton of work then run into some problem later down the line because I didn’t understand how it all worked.

    Thread Starter gulliwog

    (@gulliwog)

    UPDATE : I realized I need to also use domain mapping. I think I need to create de.mysite.com and fr.mysite.com as alternate sites then use domain mapping to give them their correct mysite.de and mysite.fr urls. But I cannot get all this to work locally. What entries do I need to add to apache or hosts to get all these things working? I redirected the https://www.mysite.com url to the local wp install with no problem… when I try to go onto the dashboard for de.mysite.com and fr.mysite.com they don’t work, but that’s understandable as those addresses have no redirect locally – where do I direct them to?! And once those work, what else do i need to do to get the domain mapping working right? I have such a migrane

    ClicksFix… You replied while I was typing this. Thanks for reply, I realized that was my problem, I just can’t seem to get my head around configuring all of this locally atm.

    • This reply was modified 7 years, 3 months ago by gulliwog.
    Thread Starter gulliwog

    (@gulliwog)

    Thanks Paul! I was beginning to wonder whether simply doing it all manually as you described wouldn’t be easier… having said that I thought that maybe a cloning plugin would make things easier.

    The problem is with this method is that any changes (switching out images etc.) that come later have to be manually made to each site. Cloning programs would be a good solution for building a static site that would never change, but it would be really nice to have a something that would allow me to dynamically control content on all the sites with some kind of management system using one database.

    Thanks for the reply!!

Viewing 9 replies - 1 through 9 (of 9 total)