
<!-- Then create a file called custom-header.js with: -->
<script>
jQuery(document).ready(function($) {
    // First part - replace explore more boxes
    $('.explore_more_box .epkb-section-body').each(function() {
        const oldBody = $(this);
        const section = oldBody.closest('section');
        const link = section.find('h2.epkb-cat-name a');

        const newDiv = $('<div>', {
            class: 'explore_more',
            css: {
                textAlign: 'right'
            }
        });

        if (link.length) {
            const newLink = $('<a>', {
                href: link.attr('href'),
                text: 'Explore More',
                css: {
                    fontWeight: '300',
                    fontSize: '25px',
                    color: '#004F4D',
                    textAlign: 'center',
                    display: 'inline-flex',
                    alignItems: 'center',
                    border: '0.7px solid #006A66',
                    padding: '17px 48px',
                    borderRadius: '10px'
                }
            });

            const newImg = $('<img>', {
                src: '/wp-content/uploads/2025/05/Vector4.png',
                alt: 'Arrow Icon',
                css: {
                    width: '20px',
                    height: 'auto',
                    marginLeft: '10px'
                }
            });

            newLink.append(newImg);
            newDiv.append(newLink);
        } else {
            newDiv.text('No link found');
        }

        oldBody.replaceWith(newDiv);
    });

    // Second part - fetch featured images via AJAX
    $('.eckb-article-container').each(function() {
        const container = $(this);
        const link = container.find('a');
        if (!link.length) return;

        const titleElement = link.find('.epkb-article__text');
        if (!titleElement.length) return;

        const postURL = link.attr('href');
        const titleText = titleElement.text().trim();
        const expectedAlt = `${titleText}-ft`;

        $.ajax({
            url: ajax_object.ajax_url,
            type: 'POST',
            data: {
                action: 'fetch_featured_image',
                post_url: postURL,
                expected_alt: expectedAlt
            },
            success: function(response) {
                if (response.success) {
                    const img = $('<img>', {
                        src: response.data.src,
                        alt: response.data.alt,
                        css: {
                            width: '100%',
                            borderRadius: '8px',
                            marginBottom: '10px'
                        }
                    });

                    const header = container.find('.eckb-article-header');
                    header.prepend(img);
                } else {
                    console.warn(`Image not found for "${titleText}"`, response.data);
                }
            },
            error: function(xhr, status, error) {
                console.warn(`Error fetching image for "${titleText}"`, error);
            }
        });
    });

    // Third part - header modification
    function modifyHeader() {
        console.log('DOM Content Loaded - Starting header modification');
        
        const header = document.getElementById('header');
        console.log('Header element found:', header);
        
        if (header) {
            console.log('Header innerHTML before modification:', header.innerHTML.length, 'characters');
            console.log('Header classes before:', header.className);
            
            const headerClasses = header.className;
            header.innerHTML = '';
            header.style.display = 'block !important';
            console.log('Header cleared. New innerHTML length:', header.innerHTML.length);
            
            const container = document.createElement('div');
            container.className = 'siteheader-container';
            console.log('Created container element');
            
            const headerRow = document.createElement('div');
            headerRow.className = 'fxb-row site-header-row site-header-main';
            headerRow.style.display = 'flex';
            headerRow.style.justifyContent = 'space-between';
            headerRow.style.alignItems = 'center';
            headerRow.style.padding = '10px 0';
            
            const leftSection = document.createElement('div');
            leftSection.className = 'fxb-col site-header-col-left';
            
            const logoContainer = document.createElement('div');
            logoContainer.className = 'logo-container';
            logoContainer.id = 'logo-container';
            
            const logoH3 = document.createElement('h3');
            logoH3.className = 'site-logo logo';
            logoH3.id = 'logo';
            
            const logoLink = document.createElement('a');
            logoLink.href = ajax_object.home_url;
            logoLink.className = 'site-logo-anch';
            
            const logoImg = document.createElement('img');
            logoImg.src = ajax_object.home_url + '/wp-content/uploads/2025/05/Logo.png';
            logoImg.alt = 'Agrobofood';
            logoImg.title = 'Connecting robotic technologies with the agrifood sector';
            logoImg.className = 'logo-img site-logo-img';
            logoImg.style.maxHeight = '60px';
            logoImg.style.width = '65%';
            logoImg.height = '60';
            console.log('Created logo image with src:', logoImg.src);
            
            logoLink.appendChild(logoImg);
            logoH3.appendChild(logoLink);
            logoContainer.appendChild(logoH3);
            leftSection.appendChild(logoContainer);
            
            const rightSection = document.createElement('div');
            rightSection.className = 'fxb-col site-header-col-right';
            rightSection.style.setProperty('display', 'flex', 'important');
            rightSection.style.setProperty('justify-content', 'end', 'important');
            rightSection.style.setProperty('padding', '20px', 'important');
            
            const searchButton = document.createElement('a');
            searchButton.href = '#';
            searchButton.className = 'search-button';
            searchButton.style.cursor = 'pointer';
            
            const searchIcon = document.createElement('img');
            searchIcon.src = ajax_object.home_url + '/wp-content/uploads/2025/05/iconamoon_search-light.png';
            searchIcon.alt = 'Search';
            searchIcon.style.maxHeight = '24px';
            console.log('Created search icon with src:', searchIcon.src);
            
            searchButton.appendChild(searchIcon);
            
            const searchContainer = document.createElement('div');
            searchContainer.id = 'search-shortcode-container';
            searchContainer.style.display = 'none';
            searchContainer.style.position = 'absolute';
            searchContainer.style.top = '100%';
            searchContainer.style.right = '0';
            searchContainer.style.backgroundColor = '#fff';
            searchContainer.style.padding = '10px';
            searchContainer.style.boxShadow = '0 2px 5px rgba(0,0,0,0.1)';
            searchContainer.style.zIndex = '1000';
            searchContainer.style.marginRight = '40px';
            searchContainer.style.borderRadius = '10px';
            searchContainer.style.border = '1px solid #8D8C8C';
            
            const searchForm = document.createElement('form');
            searchForm.method = 'get';
            searchForm.action = ajax_object.home_url;
            searchForm.className = 'kb-search-form';
            searchForm.style.display = 'flex';
            searchForm.style.alignItems = 'center';
            searchForm.style.gap = '10px';
            
            const searchInput = document.createElement('input');
            searchInput.type = 'text';
            searchInput.name = 's';
            searchInput.placeholder = 'Search Knowledge Base...';
            searchInput.required = true;
            searchInput.style.border = 'none';
            searchInput.style.outline = 'none';
            searchInput.style.backgroundColor = '#fff';
            searchInput.style.color = '#000';
            searchInput.style.padding = '8px 12px';
            searchInput.style.width = '200px';
            searchInput.style.fontSize = '14px';
            
            const hiddenInput1 = document.createElement('input');
            hiddenInput1.type = 'hidden';
            hiddenInput1.name = 'post_type[]';
            hiddenInput1.value = 'knowledge_base';
            
            const hiddenInput2 = document.createElement('input');
            hiddenInput2.type = 'hidden';
            hiddenInput2.name = 'post_type[]';
            hiddenInput2.value = 'faq';
            
            const submitButton = document.createElement('button');
            submitButton.type = 'submit';
            submitButton.textContent = 'Search';
            submitButton.style.border = 'none';
            submitButton.style.outline = 'none';
            submitButton.style.backgroundColor = '#fff';
            submitButton.style.color = '#000';
            submitButton.style.padding = '8px 12px';
            submitButton.style.cursor = 'pointer';
            submitButton.style.fontSize = '14px';
            
            searchForm.appendChild(searchInput);
            searchForm.appendChild(hiddenInput1);
            searchForm.appendChild(hiddenInput2);
            searchForm.appendChild(submitButton);
            searchContainer.appendChild(searchForm);
            rightSection.appendChild(searchContainer);
            rightSection.appendChild(searchButton);
            
            searchButton.addEventListener('click', function(e) {
                e.preventDefault();
                console.log('Search button clicked');
                if (searchContainer.style.display === 'none') {
                    searchContainer.style.display = 'block';
                    console.log('Search container shown');
                } else {
                    searchContainer.style.display = 'none';
                    console.log('Search container hidden');
                }
            });
            
            headerRow.appendChild(leftSection);
            headerRow.appendChild(rightSection);
            container.appendChild(headerRow);
            
            const headerWrapper = document.createElement('div');
            headerWrapper.className = 'site-header-wrapper sticky-top-area';
            headerWrapper.appendChild(container);
            
            header.appendChild(headerWrapper);
            header.className = headerClasses;
            header.style.display = 'block';
            header.style.visibility = 'visible';
            header.className = headerClasses;
            
            console.log('Header modification complete!');
            console.log('New header innerHTML length:', header.innerHTML.length);
            console.log('Header is visible:', window.getComputedStyle(header).display !== 'none');
            
        } else {
            console.error('Header element with ID "header" not found');
            console.log('Available elements with class containing "header":', document.querySelectorAll('[class*="header"]'));
        }
    }

    // Run immediately and also with a delay as fallback
    modifyHeader();
    setTimeout(modifyHeader, 2000);
});
</script>

<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="//old.agrobofood.eu/wp-content/plugins/wordpress-seo/css/main-sitemap.xsl"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
	<sitemap>
		<loc>https://old.agrobofood.eu/post-sitemap.xml</loc>
		<lastmod>2025-07-23T05:51:40+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://old.agrobofood.eu/page-sitemap.xml</loc>
		<lastmod>2025-10-27T07:20:22+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://old.agrobofood.eu/docs-sitemap.xml</loc>
		<lastmod>2025-04-07T07:29:37+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://old.agrobofood.eu/onepage-docs-sitemap.xml</loc>
	</sitemap>
	<sitemap>
		<loc>https://old.agrobofood.eu/epkb_post_type_1-sitemap.xml</loc>
		<lastmod>2025-06-23T08:55:50+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://old.agrobofood.eu/zn_layout-sitemap.xml</loc>
		<lastmod>2020-02-12T12:09:51+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://old.agrobofood.eu/portfolio-sitemap.xml</loc>
		<lastmod>2022-05-20T09:37:23+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://old.agrobofood.eu/documentation-sitemap.xml</loc>
	</sitemap>
	<sitemap>
		<loc>https://old.agrobofood.eu/znpb_template_mngr-sitemap.xml</loc>
		<lastmod>2020-05-28T08:12:03+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://old.agrobofood.eu/category-sitemap.xml</loc>
		<lastmod>2025-07-23T05:51:40+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://old.agrobofood.eu/post_tag-sitemap.xml</loc>
		<lastmod>2023-03-14T10:13:44+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://old.agrobofood.eu/project_category-sitemap.xml</loc>
		<lastmod>2022-05-20T09:37:23+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://old.agrobofood.eu/epkb_post_type_1_category-sitemap.xml</loc>
		<lastmod>2025-06-23T08:55:50+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://old.agrobofood.eu/author-sitemap.xml</loc>
		<lastmod>2025-07-21T14:19:42+00:00</lastmod>
	</sitemap>
</sitemapindex>
<!-- XML Sitemap generated by Yoast SEO -->