| WordPress Meet HTML |
| by REFERDEAL |
| Article Source: Original |
We need to be able to differentiate whether reader is responding
directly from blog (of which we want to retain the original behavior),
or posting from content site (of which we want to redirect back to article).
The last step depends slightly on your WP installation path. Because
my WP resides in the blog subdirectory, I am using the following
logic to determine the redirection.
- if URL contains BLOG, then this is a reponse posted from blog, do nothing
- If URL does not contain BLOG, then this is a response posted from article,
redirect back to article
WordPress will redirect to the respective URL if there exist a
form field named redirect. Hence, we insert in the form a hidden
field named "redirect_to" with value = article URL. This is accomplished by modifying the comments.php before the form tag closes.
<?php
/*-- wk --*/
$url = $_SERVER['URL'];
// if url does not contains blog, this form is for z.php
// we should redirect back to original url after post
if(strpos($url,'blog/')==false){
echo '<input type="hidden" name="redirect_to" value="'.$url.'">';
}
/*-- == --*/
?>
</form>
And we are done.
You may want to tidy up the stylesheet to ensure
the overall look and feel of the new template merges with your main
site. How does it look like? You are now looking at it here at the end of the article (or all the articles in this website).
You can find the download for this tutorial here. The zip includes:
- backup of original files (classes.php_v20, template-loader.php_v20)
- customized WordPress core (classes.php, template-loader.php)
- customized comments in default theme (comments.php)
- new template (z.php)
|