I'm having a strange problem with a Wordpress site I built recently, wherein when users visit one of the website's pages via search engine (typically Google), a bit of strange markup is generated inside the footer element. That markup is an unordered list of dates linking to non-existent archive pages, and an unordered list of categories linking to non-existent category pages.
The strange thing here is that there is no code in the theme that would generate this markup, and even more peculiarly, the categories in the unordered list don't exist in the site's database. My first thought was that this could be the result of a possible malware infection, but since the links don't direct the user offsite, that seems unlikely. It would also be strange for the malware to generate problems only when the site is accessed via search engine.
I've been scouring the Internet looking for an example of this occurring, but have yet to find anything, and though I've been working in WP dev for over a year now, this is my first time encountering such a problem. So, my question is this: have any of you encountered something like this before, and if so, do you have any ideas on what could be the problem source, and/or do you have recommendations about how to go about debugging the issue?
NOTE: I have already hidden the markup using CSS for a user-facing solution, so I'm looking for an answer to help me address the problem more sustainably; i.e., finding a way to eliminate the markup in question.
Thanks!!
<ul>
<li><a href='http:/2015/10/'>October 2015</a></li>
<li><a href='http:/2015/09/'>September 2015</a></li>
<li><a href='http:/2015/07/'>July 2015</a></li>
<li><a href='http:/2015/06/'>June 2015</a></li>
</ul>
<ul>
<li class="categories">Categories<ul>
<li class="cat-item cat-item-14"><a href="/category/articlesorder/" >articles,order</a>
</li>
<li class="cat-item cat-item-13"><a href="/category/articlesus/" >articles,us</a>
</li>
<li class="cat-item cat-item-11"><a href="/category/businesswriting/" >business,writing</a>
</li>
<li class="cat-item cat-item-16"><a href="/category/englishorder/" >english,order</a>
</li>
<li class="cat-item cat-item-17"><a href="/category/serviceterm/" >service,term</a>
</li>
<li class="cat-item cat-item-12"><a href="/category/shoolbuy/" >shool,buy</a>
</li>
<li class="cat-item cat-item-18"><a href="/category/studybusiness/" >study,business</a>
</li>
<li class="cat-item cat-item-15"><a href="/category/studypapers/" >study,papers</a>
</li>
</ul></li>
</ul>
Try to change the theme and see if it is the source of this and then disable every plugin and enable one after one to see which of them generates the code.
If this just happens when someones comes from a search engine it is called cloaking.
Please check also the code in your .htaccess and all core files.
You can use Wordfence to scan the files for changes https://de.wordpress.org/plugins/wordfence/
Related
This is Drupal 9 specific PHP issue: so bear with me.
I have several fields in Drupal field which are stored as RAW HTML, in Drupal terms which are called - Fields and the Values are stored - in field definition formatted html.
Problem : During re-edit, editor/edit screen pulls stripped html. HTML imported are strpped off HTML tags and HTML classes. And when re-edited post is saved the stripped html is getting stored(Overwritten)
This is causing serious issues for my site, cause this is a required feature. And some of my website-structue is depends upon the RAW HTML.
This could be PHP specific issue. If someone has experience regarding this, and how to get away with this - would be a help.
I need to get away with this, this is causing serious troubles with my Website Structure.
Description :
Original HTML
<ul class="nav flex-column pl-0">
<li class="nav-head">Xamarin</li>
<li class="nav-item"><a class="nav-link" href="#">Overview</a></li>
<li class="nav-item"><a class="nav-link active" href="#">Analytics</a></li>
<li class="nav-item"><a class="nav-link" href="#">Export</a></li>
<li class="nav-item"><a class="nav-link" href="#">Snippets</a></li>
<li class="nav-item"><a class="nav-link" href="#">Flexbox</a></li>
<li class="nav-header">Xamarin Installation</li>
<li class="nav-item"><a class="nav-link" href="#">Layouts</a></li>
<li class="nav-item"><a class="nav-link" href="#">Templates</a></li>
<li class="nav-item"><a class="nav-link" href="#">Themes</a></li>
</ul>
When input through text-formatted-long
When imported - During re-edit the formatted-field is striping html tags, and does not pull full html.
**For post visibility, I have posted the same issue, in several forums. So, this is not spammy qusetion, genuine development question
Choose Text format as Full HTML, your HTML will not be stripped anymore.
Update:
It seems that your use of module Gutenberg did not display the Text format options. So, install the module Allowed Formats then enable the format Full HTML for your field.
I have written some code that will highlight a link in the header based on: class="active". The class is connected to some CSS code to style it.
I am currently adding the class="active" the specified link for each page. However, since I want to move my header into it's own file and include it on each page, I will lose the ability to set the class for each page. I could of course add a variable that will allow me to sort of do the same thing.
What I wish to know is if there is a better and secure way to automatically set the class="active" to the page that I am on. I have seen some posts that suggest using: ($_SERVER['PHP_SELF'] but I have read that it could cause some security issues.
Lastly the main problem that I have is that I need to set two links to
class="active" if I am viewing a page that is in the portfolio list item. For instance, if games.html is currently viewed, both the games and the portfolio page should have the code: class="active".
(All of my .html files are read as .php)
Here is the html code I have so far:
<ul>
<li>Home</li>
<li><a class="active" href="portfolio.html">Portfolio</a>
<ul>
<li><a class="active" href="games.html">Games</a></li>
<li>2D Art</li>
<li>3D Models</li>
<li>Particles</li>
<li>Shaders</li>
<li>Environments</li>
<li>Programming</li>
<li>Substance Designer</li>
<li>Music</li>
</ul>
</li>
<li>About</li>
<li>Contact</li>
<li>Store</li>
</ul>
Any help will be appreciated!
PHP_SELF is safe when you only use it to compare values and don't directly use it in your html:
The portfolio menu can be made active by nested all related pages in a folder called portfolio and checking if the path starts with that folder.
<?php
$currentPage = $_SERVER['PHP_SELF'];
$portfolioFolder = 'portfolio/';
$isPortfolioFolder = substr($currentPage, 0, strlen($portfolioFolder)) == $portfolioFolder);
?>
<ul>
<li>Home</li>
<li><a class="<?= $isPortfolioPage ? 'active' : '' ?>" href="portfolio.html">Portfolio</a>
<ul>
<li>Games</li>
<li>2D Art</li>
<li>3D Models</li>
<li>Particles</li>
<li>Shaders</li>
<li>Environments</li>
<li>Programming</li>
<li>Substance Designer</li>
<li>Music</li>
</ul>
</li>
<li>About</li>
<li>Contact</li>
<li>Store</li>
</ul>
I'm stucked in my own solution — it's THE real problem what I wanted to solve. I defined my <base> URL in my PHP project, now all the hashed links
<ul class="nav nav-tabs nav-justified">
<li role="presentation" class="active">
Tab Handle
</li>
</ul>
are taking me to the base. It's not just the tab, it's everything: If I provide a hashed <nav> element, it's also taking me to the base URL (home URL).
And that's taking a page refresh so, which is another awkward situation.
How can I solve this?
Okay, I got a solution. Thanks to #Adam.
<base href="http://localhost/project/">
<ul class="nav nav-tabs nav-justified">
<li role="presentation" class="active">
Tab Handle <!-- it'll work like a hash link -->
</li>
</ul>
My colleague and I are working on a WordPress-Plugin that generated posts using a custom post type. It all work's fine until You look at the posts. The generated pages look good and use the Themes single.php template. The only problem is, that the menu, that works on all other pages of the site is empty on the pages generated by the plugin.
By empty I mean that the structure including links is there, just the text inside the <a> tags.
The generated menu on a post generated by the plugin looks like this
<nav id="primary-navigation" class="site-navigation primary-navigation" role="navigation">
<div class="nav-menu">
<ul>
<li class="page_item page-item-1763">
</li>
<li class="page_item page-item-1761">
</li>
[...]
</ul>
</div>
</nav>
For all other pages, the menu looks like this:
<nav id="primary-navigation" class="site-navigation primary-navigation" role="navigation">
<div class="nav-menu">
<ul>
<li class="page_item page-item-1763">
About
</li>
<li class="page_item page-item-1761">
Galerie
</li>
[...]
</ul>
</div>
</nav>
As You can see, the only difference is that there is no text between the <a> and </a> tags, which makes the menu unusable.
We really have no idea of how the plugin / custom-post-type creates this issue, as we tried this with different themes, and they all behave the same - so it is not an issue with the theme.
Any comment or hint that points in the right direction is greatly appreciated.
In TYPO3 I used html blocks which contains a nav of hash-tags
<li class="navbox default">
About us
</li>
<li class="navbox default">
Shop
</li>
<li class="navbox default">
Images
</li>
<li class="navbox default">
News
</li>
<li class="navbox default">
Sale
</li>
<li class="navbox default">
Contact us
</li>
This nav is used for Bootstraps Scroll-Spy and the hash-tags represent content-elements. Everything works fine, but only for the page "/". If I open the page in another language like /de.html or /en.html, TYPO3 prepend this part to the href and I get something like this
About us
This is fine for most cases, but Bootstraps Scroll-Spy expect all links as a "pure" Hash without anything in front.
My question is now, how can I disable TYPO3 parsing of html blocks/link replacement? I don't want to modify the bootstrap js files
config.prefixLocalAnchors = 0 is your friend if it is compatible to the rest of your environment (e.g. RealURL configuration):
http://docs.typo3.org/typo3cms/TyposcriptReference/Setup/Config/Index.html?highlight=prefixlocalanchors