Forums

aditinal http get value in blog links (8 posts)

  1. slith
    Member
    Posted 3 years ago #

    Hi I was wondering if anyone could help me.

    I would like all links on my blog to have a custom value appended to its URL. So in php I can use $_REQUEST['x'] to see what this value is.

    Eg,

    http://site.com/wordpress/?p=1&x=value#comments
    and
    http://site.com/wordpress/diablo/?page_id=3&x=value

    So I need someway to modify all the URLS wordpress generates to have "&x=value" in the appropriate place.

    Any suggestions are welcome. Thanks

  2. Glenn Ansley
    Member
    Posted 3 years ago #

    will the key / value always be the same?

  3. slith
    Member
    Posted 3 years ago #

    Yes

  4. Glenn Ansley
    Member
    Posted 3 years ago #

    Maybe I don't understand. If all pages are going to have the same key / value, why do you need to use $_REQUEST to know what it is?

    When you say all links, do you mean href links or pages?

  5. slith
    Member
    Posted 3 years ago #

    Let me explain what I am trying to do.

    I have a main php script which wraps around wordpress (mysite_index.php).

    In mysite_index.php the code is like.

    if($_REQUEST['page'] == 'blog'){
    require('./wordpress/wp-blog-header.php');
    }else if($_REQUEST['page'] == 'register'){
    require('./register.php');
    }//etc....

    Now in the included wordpress code through require('./wordpress/wp-blog-header.php'); I want wordpress to generate its links like.

    http://site.com/?p=1&page=blog#comments
    and
    http://site.com/?page_id=3&page=blog

    So the wrapping mysite_index.php script knows to include wordpress which is located under http://site.com/.

    Sorry, Its difficult to explain

  6. Glenn Ansley
    Member
    Posted 3 years ago #

    Hmmm. Try putting this in your functions.php file:

    add_action('init','thisismyblog');
    function thisismyblog(){
         $_GET['page']='blog';
    }

    Let me know if that works.

  7. slith
    Member
    Posted 3 years ago #

    Good thinking and nice try.
    Unfortunatlly no luck.

    Printing out $_GET in thisismyblog() gives..

    Array ( [m] => 200810 [page] => blog )

    I think my problem is difficult because WordPress dosnt generate its links through one common function. Then again im no expert on wordpress...

  8. Glenn Ansley
    Member
    Posted 3 years ago #

    Why don't you just put WordPress in a subfolder called blog?

Topic Closed

This topic has been closed to new replies.

About this Topic