【问题标题】:Job posted message displaying职位发布消息显示
【发布时间】:2016-09-20 05:51:11
【问题描述】:

用户提交“您发布的工作正在等待审核”表单后,我需要在同一页面上显示短信。任何帮助,将不胜感激。以下是模板中的代码。

                <?php
                    if( isset( $_GET['action'] ) && $_GET['action'] == 'edit' ){
                        $button_text = __( 'Update Job', 'jobboard' );
                ?>
                    <input type="hidden" name="form_type" id="form_type" value="edit_post_job" />
                    <input type="hidden" name="post_id" id="post_id" value="<?php echo esc_attr( $default['post_id'] ); ?>" />
                <?php
                    }else{
                        $button_text = __( 'Post A Job', 'jobboard' );
                ?>
                    <input type="hidden" name="form_type" id="form_type" value="post_job" />
                <?php
                    }
                ?>
                <input type="hidden" name="user_id" id="user_id" value="<?php echo esc_attr( get_current_user_id() ); ?>" />
                <button type="submit" name="submit" class="btn btn-post-resume"><?php echo esc_attr( $button_text ); ?></button>

            </form>
        </div><!-- /.col-md-8 -->

        <?php get_sidebar(); ?>

    </div><!-- /.row -->
</div><!-- /.container -->

【问题讨论】:

    标签: php wordpress


    【解决方案1】:

    使用查询字符串将您的网址重定向到同一页面,然后在您的页面中获取并回显查询字符串。

    【讨论】:

    • 你可以给我看一个如何在同一页面重定向 url 的例子
    【解决方案2】:
    $msg="Project Detail succesfully Submit";
    header("location: index.php?msg=Project Detail succesfully Submit");
     <h3><strong> <?php echo $_GET['msg'];?></strong> </h3>
    

    【讨论】:

      【解决方案3】:

      在隐藏的for字段中,使用这个逻辑

      全球 $wp; $current_url = home_url(add_query_arg(array(),$wp->request)); ?>

      参考:http://cubiq.org/front-end-user-registration-and-login-in-wordpress

      因此,如果成功,则将重定向到“redirect_to”,否则将显示到错误页面。因此,在您的主题中,通过 $_GET['success'] == 1 获取值,然后打印您的自定义消息。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2021-08-11
        • 2023-04-04
        • 2019-05-26
        • 1970-01-01
        • 1970-01-01
        • 2014-07-22
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多