Error on line
-
Hi everyone,
I have generete a sitemap with SEO Press and when I visit this page I Get the following error?
This page contains the following errors:
error on line 3 at column 6: XML declaration allowed only at the start of the document
Below is a rendering of the page up to the first error.I don’t know what to do… Hopefully you can help me with this error?
– Rick
The page I need help with: [log in to see the link]
-
Hi,
I don’t SEOPress activated on your site.
Plus, the URL of your XML sitemaps with SEOPress should be:
He, I was trying something else, so my sitemap url changed. Now I have activate SEO Press again.
https://ricktimmermans.com/sitemaps.xml
-
This reply was modified 3 years, 10 months ago by
rkscreativeagency.
Hi,
there is some extra empty lines at the beginning of the sitemap that breaks it.
You have probably not enqueue correctly some CSS or JavaScript.
It could also be a bad opening/closing PHP tag.
Check your header.php, wp-config.php… files.
-
This reply was modified 3 years, 10 months ago by
Benjamin Denis.
I see, it’s because I use a child theme and not the original theme.
If I switch to the original then my sitemap works, but I need a child theme for custom javascript.
Is there another way to have a child theme but still have the sitemap working?
Hi,
you can have a child theme without problem.
It simply means, you have something not correctly coded.
Check every child theme files that they don’t have empty lines at the beginning before
<?phpopening tag.This is the only edit I made in the function.php. Here is the file:
<?php if ( ! defined('ABSPATH') ) { die(); } add_action('wp_enqueue_scripts', 'ds_ct_enqueue_parent'); function ds_ct_enqueue_parent() { wp_enqueue_style('parent-style', get_template_directory_uri() . '/style.css'); } add_action('wp_enqueue_scripts', 'ds_ct_loadjs'); function ds_ct_loadjs() { wp_enqueue_script('ds-theme-script', get_stylesheet_directory_uri() . '/ds-script.js', array('jquery')); } include('login-editor.php'); ?> <?php // Enqueue Swiper.js Library function dp_carousel(){ wp_enqueue_script( 'your-swiper-js-slug', 'https://unpkg.com/swiper@7/swiper-bundle.min.js', [] , '7.0.2', true ); wp_enqueue_style( 'your-swiper-css-slug', 'https://unpkg.com/swiper@7/swiper-bundle.min.css', [] , '7.0.2'); } add_action('init', 'dp_carousel', 99); function dp_carousel_slider_scripts() { ?> <script type="text/javascript"> // adding navigation html (function(){ window.addEventListener('DOMContentLoaded', function(){ let sliders = document.querySelectorAll('.dp-carousel') sliders.forEach(function( slider ) { swiper_init(slider) }) }); function swiper_init(slider){ // configuration if(slider === null) return; // extra controls let extraControls = ''; // If we need pagination extraControls += '<div class="swiper-pagination"></div>'; // If we need navigation buttons extraControls += '<div class="swiper-button-prev"></div><div class="swiper-button-next"></div>'; slider.innerHTML = '<div class="swiper-container" style="overflow:hidden">' + slider.innerHTML + '</div>' + extraControls; // Wait for Swiper var waitForSwiper = setInterval( function () { if (typeof Swiper != "undefined") { clearInterval(waitForSwiper); let carousel_container = slider.querySelector('.swiper-container'); const swiper = new Swiper( carousel_container , { slidesPerView: 1.25, // mobile value loop: true, spaceBetween: 20, // mobile value autoplay: { delay: 7000, }, speed: 1000, // If we need pagination pagination: { el: '.swiper-pagination', clickable : true, dynamicBullets: true }, // Navigation arrows navigation: { nextEl: '.swiper-button-next', prevEl: '.swiper-button-prev', }, breakpoints: { 768: { // Tablet slidesPerView: 1.6, spaceBetween: 20, }, 981: { // Desktop slidesPerView: 2.6, spaceBetween: 30, } } }); } }, 20); } })(); </script> <?php } add_action( 'wp_footer', 'dp_carousel_slider_scripts');-
This reply was modified 3 years, 10 months ago by
rkscreativeagency.
I found the error!
include('login-editor.php'); ?> <?php // Enqueue Swiper.js LibraryI had an enter between my ?> and the <?php
thanks for pointing me in the right direction 🙂
Perfect!
-
This reply was modified 3 years, 10 months ago by
The topic ‘Error on line’ is closed to new replies.