WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Lost some complex formatting when transferring servers (50 posts)

  1. Marie0930
    Member
    Posted 1 year ago #

    Okay I tried the find first and nothing. I did see that there is an area where div id is defined like the following:

    div id="inner" <--could this be pulling the "text-1, text-2, text-3, ect" from somewhere?

  2. ALVAW3
    Member
    Posted 1 year ago #

    the inner div usually contains its own CSS but not in a way that changes IDs

  3. Marie0930
    Member
    Posted 1 year ago #

    After reading the JQuery review you sent I believe the div id is being called by JQuery already in the system using the " Set the id for divs based on the position in the page." from http://api.jquery.com/attr/. With that being said.....would I still do as you outlined in the footer, Andrew?

  4. Andrew
    Forum Moderator
    Posted 1 year ago #

    You could do as I outlined in the footer, but if you're duplicating code you could instead find the jQuery that's executing this already and modify that.

  5. Marie0930
    Member
    Posted 1 year ago #

    So if I do as outlined in the footer. For example;

    <script type="text/javascript">
    jQuery(document).ready(function($) {
    $('text-3').attr('id', 'text-19');
    }
    </script>

    If I wanted to change all of them at once could I do:

    <script type="text/javascript">
    jQuery(document).ready(function($) {
    $('text-3').attr('id', 'text-19');
    $('text-4').attr('id', 'text-20');
    $('text-7').attr('id', 'text-22');
    }
    </script>

    OR is that not the correct format?

  6. Andrew
    Forum Moderator
    Posted 1 year ago #

    If I wanted to change all of them at once could I do:

    Yes, that looks almost correct but these parts are a bit wrong,

    $('text-3') ...
    $('text-4') ...
    $('text-7') ...

    That's the bit where jQuery identifies what element to apply the attribute to. So if you were trying to apply the attribute to a div, you need to have div in there, similar to CSS.
    E.g

    $('div') ...

    You may need use specific div elements, so you don't apply these attributes to all <div> elements.
    E.g

    // Double Forward slashes means comments and won't be executed.
    
    // <div id="text-3"> selector (below)
    $('div#text-3') ...
    
    // <div id="text-4"> selector (below)
    $('div#text-4') ...
    
    // <div id="text-7"> selector (below)
    $('div#text-7') ...
  7. Marie0930
    Member
    Posted 1 year ago #

    Okay so more like this: (The first being the incorrect current id and the latter one what I want it changed to)

    <script type="text/javascript">
    jQuery(document).ready(function($) {
    $('div#text-3').attr('id', 'text-19');
    $('div#text-14').attr('id', 'text-11');
    $('div#text-8').attr('id', 'text-10');
    $('div#text-7').attr('id', 'text-23');
    $('div#text-6').attr('id', 'text-24');
    $('div#text-9').attr('id', 'text-8');
    $('div#text-10').attr('id', 'text-9');
    $('div#text-11').attr('id', 'text-22');
    $('div#text-11').attr('id', 'text-22');
    }
    </script>

  8. Andrew
    Forum Moderator
    Posted 1 year ago #

    That looks about right. Try it out.
    If it doesn't work, look at your Inspect Element tool, under the 'Console' section and post here the errors generated.

  9. Marie0930
    Member
    Posted 1 year ago #

    Didn't work....They didn't change using that method. For example, the first item was a div id="text-3" and I wanted it to be div id="text-19".

    I posted the code I gave in the previous post to the footer.php where you suggested and the source is still showing "text-3" instead of the 19. No error messages though at all.

    Does it matter that is is running off a childsheet template? I put this in the parent theme footer.php. The childtheme does not have a footer.php so would that make a difference?

  10. Andrew
    Forum Moderator
    Posted 1 year ago #

    Does it matter that is is running off a childsheet template? I put this in the parent theme footer.php. The childtheme does not have a footer.php so would that make a difference?

    That shouldn't matter.

    When you use your browser's inspector tool on the <div> elements, do they have two IDs now?
    E.g

    <div id="text-3 text-19">
  11. Marie0930
    Member
    Posted 1 year ago #

    No they just have the one.

  12. Andrew
    Forum Moderator
    Posted 1 year ago #

    I can only assume the elements that have those ids cannot be found.
    E.g These elements

    <div id="text-3">
    <div id="text-14">
    <div id="text-8">

    Et cetera.

    Make-sure the id values and HTML element type.

  13. Marie0930
    Member
    Posted 1 year ago #

    Okay.....So if it can't find them but they are in the source code what could cause that? There is most definitely a line in the source code that says:

    "<div id="text-3">" so what should my next step be?

    They are using a plugin called Scripts and Styles that is where they added the majority of their items. I tried adding the suggested JQuery in both the footer.php as well as direct into the plugin that places those items on the footer.php doc. Neither way worked.

    Could it be that there is another JQuery overwriting what I am requesting? Or that it is calling on after mine?

  14. Andrew
    Forum Moderator
    Posted 1 year ago #

    I don't know the answer to next steps, however this thread should be visited by other forum volunteers and will be in WordPress' "Unresolved" forum thread list. You will receive help from others.

  15. Marie0930
    Member
    Posted 1 year ago #

    Okay great. I will do some research on JQuery and look and see if I can somehow find the exact JQuery function that is naming these and fix it that way.

    I wish there was an easy replacement method such as the one you described to overwrite the IDs at the end so I know everything else has loaded first so that I know the ID could be found.

    I will keep working on it and hopefully someone will have some useful insight.

  16. Marie0930
    Member
    Posted 1 year ago #

    Not sure if there is anyone out there with more insight into this. What I have figured out since the last post yesterday.

    Though I could not find the location to change the div IDs, I did find where some of the IDs were being called to styling. So I sort of worked backwards from the initial plan. Instead of matching up the div IDs I changed the styling to reflect the new IDs. This worked! However, I was only able to find half of the styling calls for the IDs. The others are nowhere.

    So here is what I need to do. I think I am just going to call those IDs and restyle. So if I have a defined widget area and four widgets contained in that area and wanted them to be side-by-side (with the exception of the last two laying one on top of the other) how would I do that?

    So I would need it to be layed out like this:

    Widget 1 Widget 2 Widget 3
    Widget 4

    Widget 1 and 2 are larger vertically than Widget 3 and 4. Widget 3 and 4 I would want next to widget area 2 only stacked one on top of the other.

    Currently Widget 1 and Widget 2 are side by side with a blank area where widget 3 and 4 should be. However it looks like this instead:

    Widget 1 Widget 2 (Blank area where Widget 3 over 4 would fit)

    Widget 3

    Widget 4

    Hope that made sense.

    Thanks in advance.

  17. Marie0930
    Member
    Posted 1 year ago #

    Actually that didn't post correct. In the "way I need it to look" the widget 4 should be underneath Widget 3 not Widget 1.

  18. Marie0930
    Member
    Posted 1 year ago #

    And I think you should be able to view the site now......the one that is setup like I want it is http://www.lakecountrychevy.com

    The site with the mixed up formatting is http://sandbox.lakecountrychevy.com ( I think it should be public now and viewable.)

  19. Marie0930
    Member
    Posted 1 year ago #

    Figured it out. Thanks everyone. I used the google Chrome inspect element tool where I found the exact location of the CSS for each text and changed them manually there. So worked it backwards from the original idea.

  20. ALVAW3
    Member
    Posted 1 year ago #

    :) excellent! Glad you got it working

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.