PHP-sayfalar boyunca wordpress başlık değerini gönderme

1 Cevap

Geçenlerde olay yazılan altında bir bağlantıyı tıklayarak zaman, bir olay için bir takım kayıt olabilirsiniz bu wordpress blog, yaptı. Bu bağlantı başka bir php sayfasında bir kayıt formu götürür. Bu bağlantı bu gibi olaylar-şablonun döngü içinde ilave edilir:

<?php query_posts('cat=8');?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

        <div class="post" id="post-<?php the_ID(); ?>">

        <h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
        <div id="tilmeldknap"><?php wp_list_pages("title_li=&depth=1&include=63"); ?></div>
        <?php include (TEMPLATEPATH . '/inc/meta.php' ); ?>...

So every upcoming event will have the same sign-up button. All I need now is to somehow send the specific event-post-title along to the sign-page, so that the following form-submit action will contain that title aswell. But since I'm not very good at php it seems like a mystery, altho I bet it's very simple!

Ben böyle bir şey tahmin ediyorum:

$event=$_POST['single_post_title()']

Ama hiçbir fikrim yok sonraki php-sayfaya değerini almak nasıl ... yardım lütfen, herkes :)

An eksample can be seen throught this link: http://gadebold.dk/events/ The link sais: 'Tilmeld Hold'

1 Cevap

Eğer ben senin olduğunu varsayarak bir form kullanıyorsanız, gizli alanları kullanabilirsiniz ..

<!-- assuming you are using page slugs -->
<form method='post' action='<?php echo site_url('\sign-up\')?>'>
<input type='hidden' name='post_title' value='<?php echo single_post_title() ?>'>
....<!-- rest of form -->
</form>

Ve alıcı sayfasında,

<?php

  $post_title = $_POST['post_title'];

 ?>

Eğer bir düğmeyi kullanarak değilseniz, size URL sayfa başlığı gömmek ve $ _GET kullanarak gönderebilirsiniz

<a href='<?php echo site_url('\sign_up\').'?title='.single_post_title()?>'>Register</a>

 ....
$post_title = $_GET['post_title'];

Bir yan not olarak, Pods CMS bu gibi sistemleri yapmak için harika bir eklenti olduğunu ve geliştirme süresini azaltmak için yardımcı olabilir.