WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] sidebar widget issues after modifying .htaccess file (4 posts)

  1. Marventus
    Member
    Posted 4 years ago #

    Hello, everybody. I've been experimenting a very unusual and rather annoying behavior with one of my widgets on the sidebar after enabling Permalinks my blog. For those of you who are not familiar with or do not use the Permalinks feature, basically what it does is that it changes the way your links are displayed in the navigation bar through a rather simple mod_rewrite command added to the .htaccess file that lies in the domain root folder.
    Before describing my actual problem, here's some useful information about my WP installation:
    <style="text-decoration: underline>WP version:</style> 2.9.1.
    <style="text-decoration: underline>WP Template: Apollo WP Theme
    Relevant plugins running: Exec-php, Role Manager
    <style="text-decoration: underline>Problem Blog:</style> Laws and Languages

    Ok, so basically what is happening is that every time I try to enable Permalinks (any option other than "default"), my custom-made ads are no longer displayed: instead I only see blank spaces inside the box where they should be and also the links (but no actual images/ads). At first, my custom ads where displayed directly from the sidebar.php file called by standard div commands, but then since this blog is ran by my GF (who is not very html savvy) I thought of including them as a widget so she could move them around if she wanted to.

    My first idea was to create a comads.php (stands for "COMmercial ADS") file inside my WP installation, and call that php file using the Exec-PHP plugin and a simple php include command (added as an "Arbitrary text" in the Widgets WP admin panel. That worked like a charm until I went and enabled the Permalinks feature.

    After I encountered this problem, I thought there could be an incompatibility with the plugin, so I contacted the plugin developer who suggested I tried ABSPATH instead. I tried both ABSPATH and TEMPLATEPATH but neither worked, so I replaced the php function call with the contents of my comads.php file (without any of the php tags). This didn't work either. The funny thing is that if I disable Permalinks (set it back to Default), it's starts working, but the minute I enable it again it doesn't.

    This is the markup html code for the ads:

    <div class="comadspot">
    	<div class="comadspot2">
            <!-- Ad1 start -->
            <a id="comad1" href="mailto:info@lawsandlanguages.com?subject=Quote Request - Ad ID: LLcad1" title="Click on this Ad to request a quote"><span></span></a>
            <!-- Ad2 start -->
            <a id="comad2" href="mailto:info@lawsandlanguages.com?subject=Quote Request - Ad ID: LLcad2" title="Click on this Ad to request a quote"><span></span></a>
        <div class="clearer"></div>
       </div>
       <div class="comadspot3">
            <!-- Ad3 start -->
            <a id="comad3" href="mailto:info@lawsandlanguages.com?subject=Quote Request - Ad ID: LLcad3" title="Click on this Ad to request a quote"><span></span></a>
            <!-- Ad4 start -->
            <a id="comad4" href="mailto:info@lawsandlanguages.com?subject=Quote Request - Ad ID: LLcad4" title="Click on this Ad to request a quote"><span></span></a>
            <div class="clearer"></div>
      </div>
            <!-- Banner1 Start -->
            <div class="combans">
            <a id="comban1" href="mailto:info@lawsandlanguages.com?subject=Quote Request - Ad ID: LLban1" title="Click on this Ad to request a quote"><span></span></a>
        <div class="clearer"></div>
       </div>
       </div>

    Here's my CSS code for the ads:

    /* Commercial Ads*/
    
    #sidebar .widget .comadspot {
    	padding: 0 15px;
    	padding: 0;
    	width: 260px; }
    
    	#sidebar .widget .comadspot .comadspot2 {
    		display: block;
    		margin-bottom: 10px;
    		padding: 0; }
    
    	#sidebar .widget .comadspot .comadspot3 {
    		display: block;
    		margin-bottom: 10px;
    		padding: 0; }
    
    		#sidebar .widget .comadspot .comadspot2 .comad1, #sidebar .widget .comadspot .comadspot3  .comad3 { float: left; }
    
    		#sidebar .widget .comadspot .comadspot2 .comad2, #sidebar .widget .comadspot .comadspot3 .comad4 { float: right; }
    
    		#sidebar .widget .comadspot .comadspot2 .comad1 {
    			background: url("http://www.lawsandlanguages.com/wp-content/themes/apollo/images/Ads/commercial/LLcad1.jpg") no-repeat 0 0;
    			height: 125px;
    			width: 125px; }
    
    			#sidebar .widget .comadspot .comadspot2 .comad1:hover { background-position: 0 -125px; }
    
    			#sidebar .widget .comadspot .comadspot2 .comad1 span { display: none; }
    
    		#sidebar .widget .comadspot .comadspot2 .comad2 {
    			background: url("http://www.lawsandlanguages.com/wp-content/themes/apollo/images/Ads/commercial/LLcad2.jpg") no-repeat 0 0;
    			height: 125px;
    			width: 125px; }
    
    			#sidebar .widget .comadspot .comadspot2 .comad2:hover { background-position: 0 -125px; }
    
    			#sidebar .widget .comadspot .comadspot2 .comad2 span { display: none; }
    
    		#sidebar .widget .comadspot .comadspot3 .comad3 {
    			background: url("http://www.lawsandlanguages.com/wp-content/themes/apollo/images/Ads/commercial/LLcad3.jpg") no-repeat 0 0;
    			height: 125px;
    			width: 125px; }
    
    			#sidebar .widget .comadspot .comadspot3 .comad3:hover { background-position: 0 -125px; }
    
    			#sidebar .widget .comadspot .comadspot3 .comad3 span { display: none; }
    
    		#sidebar .widget .comadspot .comadspot3 .comad4 {
    			background: url("http://www.lawsandlanguages.com/wp-content/themes/apollo/images/Ads/commercial/LLcad4.jpg") no-repeat 0 0;
    			height: 125px;
    			width: 125px; }
    
    			#sidebar .widget .comadspot .comadspot3 .comad4:hover { background-position: 0 -125px; }
    
    			#sidebar .widget .comadspot .comadspot3 .comad4 span { display: none; }
    
    		#sidebar .widget .comadspot .combans { padding: 0; }
    
    			#sidebar .widget .comadspot .combans .comban1 {
    				background: url("http://www.lawsandlanguages.com/wp-content/themes/apollo/images/Ads/commercial/LLban1.jpg") no-repeat 0 0;
    				display: inline-block;
    				float: center;
    				height: 126px;
    				width: 260px; }
    
    				#sidebar .widget .comadspot .combans .comban1:hover { background-position: 0 -126px; }
    
    				#sidebar .widget .comadspot .combans .comban1 span { display: none; }

    And here are the contents of my .htaccess file:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress

    Any help on this WILL be greatly appreciated, since I've been going crazy trying to figure out why the heck this is happening in the first place.
    Thanks!

  2. esmi
    Forum Moderator
    Posted 4 years ago #

    It would help if you could post a link to a page demonstrating the problem. CSS snippets aren't of much use.

  3. Marventus
    Member
    Posted 4 years ago #

    Hi esmi. I thought I had provided the URL when I created the topic: sorry about that!
    Here's the URL to the blog in question.
    LMK if you need more information.
    Thanks for your interest in this issue.

    P.S.: How come after I created this topic it showed as "closed" to other members? Please tell me if I did smth wrong. Thanks!

  4. Marventus
    Member
    Posted 4 years ago #

    Hello there. I was able to figure this one out, and I'm pretty sure this might turn out to be pretty helpful for those of you running a lot of PHP commands in your blogs.

    In one word, what happened is that I realized that, one my Permalinks were on, the Commercial Ads were not the only images missing from my blog, since I had failed to see that my E-mail icon (called Email.png) was missing as well. This was quite a break, since I was kind of stuck with the info and parameters I had to work with.

    Then I remembered that, not so long ago, I had found two versions of the email.png image in my template image folder: one with capital E (Email.png) and one with no caps (email.png), and I remembered thinking it was odd that one of them wouldn't get overwritten by the other one. Back then, I just deleted one of them (email.png).

    Now, it appears that when the Permalinks are off, calls to other files (such as images) are not cap sensitive, so it does not matter if you reproduce the filepath and filename without them. However, when Permalinks ARE on, it does matter, and you need to carefully include all the caps for the file call/link to actually work.

    Basically, what I did to fix it is include all the filepath/name caps in the style.css sheet in which I was calling the ad files, and it worked. Quite frankly, I don't really understand what this behaviour is really linked to, but my (relatively newby) flare tells me that my original impression was fouded, and that it might definitely have smth to do with what the code included in me .htaccess file.

    If you have any opinions about this, please don't be shy and share them here: after all, this is all about making it simpler for those bloggers/html programmers that might land on these pages and get some useful tips from our personal experiences, right?

    Esmi, thanks again for trying to help. Cheers!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.