Jump to content

popokolok

Members
  • Posts

    7
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

popokolok's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hello, I tried many WP plugins to create automatic alt tags site-wide. None of the available plugins seem to work (I Tried SEO Friendly Images, Wordpress SEO Images, WP Image SEO) even with the default theme... Any other plugins anyone can suggest, please? Anyway, I found this code that's supposed to go into the functions.php of the theme, but it doesn't seem to work... It's supposed to check for images without an alt tag and fill in the post title - can anyone here please help me with making this code to change ALL alt tags by putting the post title in them and making this code work in the first place..? function add_alt_tags($content) { global $post; preg_match_all('/<img (.*?)\/>/', $content, $images); if(!is_null($images)) { foreach($images[1] as $index => $value) { if(!preg_match('/alt=/', $value)) { $new_img = str_replace('<img', '<img alt="'.$post->post_title.'"', $images[0][$index]); $content = str_replace($images[0][$index], $new_img, $content); } } } return $content; } add_filter('the_content', 'add_alt_tags', 99999); Thank you very much!
  2. That logic will not work. Thanks anyway, I'll work with that.
  3. Hello, I have this code: $lol=file_get_contents('http://www.website.com/something/'print $page;); print $lol; $page should fetch a random filename from an array defined earlier in the code whenever the page is refreshed, to complete the url for file_get_contents. For example: http://www.website.com/something/spoon.html How can I make the print function to work inside the file_get_contents as shown above? Do I need to escape some characters or something? Thanks in advance!
  4. Well, I have like two files that lead to the top level domain - for example: my domain.com/index.php and my domain.com/homepage.php both lead to my top-level domain.com when typed in the address, but not redirecting the surfer to the top-level domain.com... How can I use a .htaccess to redirect for example the domain.com/homepage.php to the domain.com just like redirecting the domain.com to www.domain.com using a 301 redirect? Thanks!
  5. Alright... Thanks for the info, but still could you please then tell me how do I acomplish a 301 redirect from sub-pages to the top level domain - in other words how do I make the code seen above function properly? Thanks!!
  6. Hello, If I put this in my .htaccess for my website only the first condition seems to function properly: Options +FollowSymLinks RewriteEngine on RewriteCond %{http_host} ^DOMAIN\.com [nc] RewriteRule ^(.*)$ http://www.DOMAIN.com/$1 [R=301,nc,L] RewriteCond %{http_host} ^DOMAIN\.com/Index1.php [nc] RewriteRule ^(.*)$ http://www.DOMAIN.com/$1 [R=301,nc,L] RewriteCond %{http_host} ^www\.DOMAIN\.com/Index1.php [nc] RewriteRule ^(.*)$ http://www.DOMAIN.com/$1 [R=301,nc,L] RewriteCond %{http_host} ^DOMAIN\.com/index1.php [nc] RewriteRule ^(.*)$ http://www.DOMAIN.com/$1 [R=301,nc,L] RewriteCond %{http_host} ^www\.DOMAIN\.com/index1.php [nc] RewriteRule ^(.*)$ http://www.DOMAIN.com/$1 [R=301,nc,L] RewriteCond %{http_host} ^DOMAIN\.com/index2.php [nc] RewriteRule ^(.*)$ http://www.DOMAIN.com/$1 [R=301,nc,L] RewriteCond %{http_host} ^www\.DOMAIN\.com/index2.php [nc] RewriteRule ^(.*)$ http://www.DOMAIN.com/$1 [R=301,nc,L] What do I need to do to fix it? Thanks in advance!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.