Forums

Setting cookies and echo cookei on other page (2 posts)

  1. chknabeel
    Member
    Posted 10 months ago #

    Hi Everyone,

    I have edited a sidebar widget plugin to suite my requirements. I need to set variables on category page and fetch them on single post page. I tried cookies but its not working for me or I m doing it wrong. Following is the code please check it out:

    if(is_single()) {
    			$this_category = get_category( $_COOKIE["cat_id_for_submenu"], false );
    }
    if(is_category()) {
    
    setcookie("cat_id_for_submenu", $CAT_ID, time()+3600, "/", str_replace('http://www','',get_bloginfo('url')));
    }

    Please tell where i m wrong and also if there is any alternate way of doing this. If you need more info, let me know.

    Thanks in Advance,
    Nabeel

  2. chknabeel
    Member
    Posted 10 months ago #

    Is there anybody who can help me :(

Reply

You must log in to post.

About this Topic