Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

Lay Theme Forum

  1. Home
  2. Bug Reports
  3. API fetched content visible on desktop only

API fetched content visible on desktop only

Scheduled Pinned Locked Moved Bug Reports
3 Posts 2 Posters 68 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Malwin
    wrote on Nov 28, 2024, 10:52 AM last edited by
    #1

    I'm currently fetching content via the bands in town API and displaying an artist's tour dates in a simple text form. It works fine on desktop, but on mobile the content is not visible. I have tested a lot, but so far without success.

    I also tested the script for the API call with another Wordpress theme to eliminate the possibility of errors and it works just fine there.
    Can you think of any special rules for Lay Theme that would make this not work?

    Here is a link to the development page, the tour dates are shown on the TOUR page: LINK

    I'm just a layman with code, so its a bit chaotic right now.
    Any tip would be much appreciated!

    Best
    Malwin

    1 Reply Last reply
    0
    • A Offline
      A Offline
      arminunruh
      Global Moderator
      wrote on Dec 9, 2024, 4:02 PM last edited by
      #2

      youre using a custom phone layout.
      thats why you have the desktop markup and the phone markup on your page at the same time.

      Screenshot 2024-12-09 at 16.55.39.png

      Screenshot 2024-12-09 at 16.55.58.png

      so you have the div with id="tour-dates" twice. once 1st screenshot in your custom phone layout, second one in your desktop layout

      in your javascript, whereever you get the markup for your tour dates. do:

      jQuery(".tour-dates-container").each(function(){
      jQuery(this).html(myTourdatesMarkup);
      })
      

      of course u dont have to use jquery. the idea is just: get both containers and add the markup to both.

      if you target a container using an id like, document.getElementById, I think it will only get one element, even if you have multiple with the same id, because an id is supposed to be unique

      if that somehow is not possible you could just turn off the custom phone layout for that page by clicking:
      Screenshot 2024-12-09 at 17.02.38.png

      Screenshot 2024-12-09 at 16.59.31.png

      furthermore, u have this error.

      Screenshot 2024-12-09 at 16.59.48.png

      it comes from here.

      if you have a form somwhere and you want to select the div container for it, you can do:

      window.laytheme.on('newpageshown', function(){
      // get form here
      const form = document.querySelector('.myform');
      })
      
      1 Reply Last reply
      1
      • M Offline
        M Offline
        Malwin
        wrote on Dec 10, 2024, 8:31 AM last edited by
        #3

        It worked like a charm, thanks a lot Armin!🙏🏻

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        I also code custom websites or custom Lay features.
        💿 Email me here: 💿
        info@laytheme.com

        Before you post:
        1. When using a WordPress Cache plugin, disable it or clear your cache.
        2. Update Lay Theme and all Lay Theme Addons
        3. Disable all Plugins
        4. Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code", click "Save Changes"

        This often solves issues you might run into

        When you post:
        1. Post a link to where the problem is
        2. Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
        3. If the problem is difficult to explain, post screenshots / link to a video to explain it
        Online Users
        A
        antwal
        12 minutes ago
        O
        okitswinter
        23 minutes ago
        Forgot your key, lost your files, need a previous Lay Theme or Addon version? Go to www.laykeymanager.com
        laytheme.com
        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Recent
        • Tags
        • Popular
        • Users
        • Search