Forum Replies Created

Viewing 11 replies - 1 through 11 (of 11 total)
  • Thread Starter hz-ar

    (@hz-ar)

    Hello again,
    I am trying to achieve same task via WordPress Custom page template. I tried same thing:
    add_action( ‘wp_title’, ‘AR_seo_head’ );
    function AR_seo_head($seotitle){ echo $seotitle; }

    but this time it does not work at all…

    Please guide.

    Thread Starter hz-ar

    (@hz-ar)

    I didn’t get this to be honest.
    There are two files and we they use MVC technology for this plugin. now my variable resides at View file and I believe add_action is at controller or maybe model. What I need to do is to pass value from view. And its just not working.

    Thread Starter hz-ar

    (@hz-ar)

    ok so I am doing this in the view:

    global $AR_seo_title;
    $AR_seo_title = $SyndContent->title;

    and this in parent plugin file:

    AR_seo_head($AR_seo_title);
    add_action( 'wp_title', 'AR_seo_head' );
      function AR_seo_head($x){
          return $x;
              }

    and when I do var_dump($AR_seo_title); on same page it returns NULL

    Thread Starter hz-ar

    (@hz-ar)

    Even when i do global, my plugin.php file does not read it still..
    What am I missing tho ?
    its getting exhausted now.

    Thread Starter hz-ar

    (@hz-ar)

    ok I understand what you are saying, this would be my next step. I am actually moved forward from my last mentioned post but little behind what you suggested. (Sorry, this is first time I am working on WP plugin)

    Here is how it looks like now:

    add_action( 'wp_title', 'AR_seo_head' );
     function AR_seo_head($seotitle){ echo $seotitle;  }

    Now this code exists at myplugin.php and I want to pass the value from [plugin_dir]/views/postfile.phtml

    problem is myplugin.php is not communicating with that file.

    I think I did not made myself clear enough, as I am confused myself too.

    should I make SEOTITLE a global variable, or actual variable which contains the value of actual title ? Or what else I could do to make it work ?

    Regard,

    Thread Starter hz-ar

    (@hz-ar)

    ok that works. but here is another problem. It has globally overwritten the title.

    I mean it had replaced title tag on all pages.. How can I fix that ? I only want it to change title to the page that has my plugin content.

    Thread Starter hz-ar

    (@hz-ar)

    Okay now I tried this:

    add_action('wp_title', 'my_head');
         function my_head(){
            echo ' $MyVar->title; ';     }

    and it is still adding a new title tag, and not replacing the existed one…

    Thread Starter hz-ar

    (@hz-ar)

    I have used this

    add_action('wp_head', 'my_head'); //
         function my_head(){
            echo '<title> $MyVar->title; </title> ';     }

    but that adds another <title>. does not replace the value of current <title> value.

    Thread Starter hz-ar

    (@hz-ar)

    So how can I edit header.php file via plugin ? I would have no power to make manual changes to user’s theme manually.

    Isn’t there a function or method where you just say “Hey, replace the value of title tag in <head> with following.” ?

    Forum: Hacks
    In reply to: how to add interstitial page?
    Thread Starter hz-ar

    (@hz-ar)

    I have managed to create it by added url/%%post-url##/?id=####
    now I am having other like, how to edit title tag and other meta tags in head.

    Thanks a lot for your help so far. πŸ™‚

Viewing 11 replies - 1 through 11 (of 11 total)