Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #666626

    Brian
    Participant

    I have two references in my code that are hard coded to my dev server’s URL where they should be relative URLs.

    The first is the logo. It seems to come from /wp-content/themes/x-child/framework/views/global/_brand.php but here we just have a variable:

    <?php
    
    // =============================================================================
    // VIEWS/GLOBAL/_BRAND.PHP
    // -----------------------------------------------------------------------------
    // Outputs the brand.
    // =============================================================================
    
    $site_name        = get_bloginfo( 'name' );
    $site_description = get_bloginfo( 'description' );
    $logo             = x_make_protocol_relative( x_get_option( 'x_logo' ) );
    $site_logo        = '<img src="' . $logo . '" alt="' . $site_description . '">';
    
    ?>
    <div class="x-column x-sm x-1-4" id="company-logo">
    <a href="<?php echo home_url( '/' ); ?>" class="<?php x_brand_class(); ?>" title="<?php echo $site_description; ?>">
      <?php echo ( $logo == '' ) ? $site_name : $site_logo; ?>
    </a>
    </div>
    <div class="x-column x-sm x-3-4" id="company-slogan">
    <?php 
    
    echo '<h6 class="slogan">Company Slogan.</h6>'
    
    ?>
    </div>

    Which is somehow producing this output on the homepage:

    <img src="//my.dev.server.com/wp-content/uploads/2015/10/company_logo-01.png" alt="Slogan."></a>

    Which should be:

    <img src="/word_press_root/wp-content/uploads/2015/10/company_logo-01.png" alt="Slogan."></a>

    Where is this variable set? My designer said “the only place you set up the logo is in the customize panel but you don’t put a url there you just upload a file.” If that is correct it sounds like this is a bug, the URL should be relative not absolute. She said that re-uploading it fixed it but it seems like this should not be necessary.

    The second issue is this and we haven’t figured it out yet:

    </header>
    
        
    
      <div class="x-main full" role="main">
        <article id="post-49" class="post-49 page type-page status-publish hentry no-post-thumbnail">
          <div class="entry-content">
    
                      <div id="x-section-1" class="x-section bg-image" style=" margin: 0px 0px 0px 0px; padding: 0px 0px 0px 0px; background-image: url(http://my.dev.server.com/wp-content/uploads/2015/10/bg-pattern.png); background-color: #02aed6;" data-x-element="section" data-x-params="{&quot;type&quot;:&quot;image&quot;,&quot;parallax&quot;:false}"><div  class="x-container" style="margin: 0px auto 0px auto; padding: 0px 0px 0px 0px; "><div  class="x-column x-sm x-1-1" style="padding: 0px 0px 0px 0px; "  >
    <div id="rev_slider_2_1_wrapper" class="rev_slider_wrapper fullwidthbanner-container" style="margin:0px auto;background-color:#000000;padding:0px;margin-top:0px;margin-bottom:0px;">

    Here we have:

    <div id="x-section-1" class="x-section bg-image" style=" margin: 0px 0px 0px 0px; padding: 0px 0px 0px 0px; background-image: url(http://my.dev.server.com/wp-content/uploads/2015/10/bg-pattern.png); background-color: #02aed6;" data-x-element="section" data-x-params="{&quot;type&quot;:&quot;image&quot;,&quot;parallax&quot;:false}">

    Which we need to be:

    <div id="x-section-1" class="x-section bg-image" style=" margin: 0px 0px 0px 0px; padding: 0px 0px 0px 0px; background-image: url(/wordpress_root/wp-content/uploads/2015/10/bg-pattern.png); background-color: #02aed6;" data-x-element="section" data-x-params="{&quot;type&quot;:&quot;image&quot;,&quot;parallax&quot;:false}">

    Can you help us to figure out where this is and how to correct it?

    Are we doing something wrong that we aren’t getting relative URLs where we expect them to be?

    Thanks.

    #666654

    Zeshan
    Member

    Hi Brian,

    Thanks for writing in!

    Absolute URLs are generated dynamically by WordPress using your site home url, e.g. http://www.domain.com. The reason they are showing your dev server URL could be that you have set wrong URLs under your WordPress settings Settings > General in WordPress dashboard. You need to make sure both Site Address (URL) and WordPress Address (URL) have same link (see: http://prntscr.com/93c1ln) and pointing to your live site.

    Thank you!

    #668554

    Brian
    Participant

    This was not the root cause of the issue and we are aware that those need to be changed and that was the first thing we changed when setting the site live.

    As mentioned we figured out how to fix the logo URL just by re-uplaoding it, but I guess that shouldn’t have been necessary?

    The second problem still remains and we don’t know where to fix this even manually, can you explain?

    <div id="x-section-1" class="x-section bg-image" style=" margin: 0px 0px 0px 0px; padding: 0px 0px 0px 0px; background-image: url(http://my.dev.server.com/wp-content/uploads/2015/10/bg-pattern.png); background-color: #02aed6;" data-x-element="section" data-x-params="{&quot;type&quot;:&quot;image&quot;,&quot;parallax&quot;:false}">

    Thanks.

    #668619

    Zeshan
    Member

    Hi Brian,

    Did you migrate your site from development server to the live one? If so, you need to replace the old URLs with new ones as also mentioned in WordPress migration codex article: https://codex.wordpress.org/Moving_WordPress

    That could be the reason these are still pointing to old site instead of live URL. For proper site migration with Cornerstone, we’ve created a knowledge base article that will help you understanding the process: https://community.theme.co/kb/cornerstone-migration/

    Thank you!

    #669633

    Brian
    Participant

    Of course we replaced the URLs. The question is where do we change it? We cannot find where this code is generated from to update it.

    <div id="x-section-1" class="x-section bg-image" style=" margin: 0px 0px 0px 0px; padding: 0px 0px 0px 0px; background-image: url(http://my.dev.server.com/wp-content/uploads/2015/10/bg-pattern.png); background-color: #02aed6;" data-x-element="section" data-x-params="{&quot;type&quot;:&quot;image&quot;,&quot;parallax&quot;:false}">

    This code does not get updated by changing the URL in the standard WordPress settings.

    Also, unless you intend for people to have to re-upload the logo every time they move the site then you have a bug there too.

    #669637

    Christopher
    Moderator

    Hi there,

    You need to change first section background image on your page to fix this.

    If it doesn’t help provide us with URL of page in question and login credentials.

    Thanks.

    #669643

    Brian
    Participant

    That fixed it, but the question is why these two URLs aren’t relative URLs in the first place.

    #669666

    Paul R
    Moderator

    Hi Brian,

    It’s the theme preference and the url is dynamically created base on your wordpress Site Address URl.

    So in our code it looks like this

    
    background-image: url(<?php echo site_url(); ?>/wp-content/uploads/2015/10/bg-pattern.png); 
    

    Then on the front end it’s

    
    background-image: url(http://my.dev.server.com/wp-content/uploads/2015/10/bg-pattern.png); 
    

    Hope that makes sense