GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Tech Wordpress Gurus I need help-register to read more (https://gfy.com/showthread.php?t=1254427)

charlie g 03-28-2017 05:05 AM

Wordpress Gurus I need help-register to read more
 
I have stayed away from GFY because it has turned into a turd palace polico forum. It is the best place I know when I really need wordpress help so here goes.

I am looking for a very simple way to redirect guest users to a register page when they click "read more". Everything I have found is some bloated membership plugin with lots of shit I just dont need. Anyone know of a simple hack or easy plugin that will handle this?

thanks in advance

just a punk 03-28-2017 05:17 AM

Quote:

Originally Posted by charlie g (Post 21661477)
to redirect guest users to a register page when they click "read more"

You mean when he tries to view a full article, right?

charlie g 03-28-2017 05:32 AM

yeah,


great software you sell BTW

just a punk 03-28-2017 05:35 AM

The easiest way to do it is: put this code into header.php of your WP theme:

Code:

if (!is_user_logged_in() && is_singular('post')) {
    if (wp_redirect('http://www.gfy.com/')) {
        exit;
    }
}

The code must be placed right after the first "<?php" line in header.php (before "<!DOCTYPE html>" or any other HTML code). Just make sure to replace 'http://www.gfy.com/' with URL of your login/registration page.

There is one problem, however. The search engines will not be able to see the full articles too. Course it's not a problem to make an additional check to find out if it's an SE bot or a human, to perform redirect for human surfers only, but I guess that search engines will consider it as cloaking which is a black SEO method...

So alternatively you can use this code:

Code:

if (!is_user_logged_in() && strpos(wp_remote_request(), '#more') !== false) {
    if (wp_redirect('http://www.gfy.com/')) {
        exit;
    }
}

It won't block search engines from crawling your full-text pages, but it won't block your surfers from visiting them too, if the post URL is opened in the browser directly. The redirect trick will work only in case if a surfer has clicked "read more".

charlie g 03-28-2017 06:49 AM

Awesome..... works like a charm! And anyone looking to automate a network check out cyberseo's product. Not many scripts I have ever bought that I would recommend to a friend, but this is one of them. Not sucking up, but it's truly useful


All times are GMT -7. The time now is 06:47 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123