custom-service.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <!doctype html>
  2. <html>
  3. <?php include 'head.php'; ?>
  4. <body>
  5. <?php
  6. /*Template Name: Custom Service*/
  7. get_header();
  8. ?>
  9. <div class="ny_ban"><img src="<?php echo get_stylesheet_directory_uri(); ?>/assets/images/server-banner.jpg"></div>
  10. <div class="ny_main w1200">
  11. <div class="l">
  12. <div class="box">
  13. <div class="tit">连锁系统</div>
  14. <div class="bor">
  15. <ul class="lm">
  16. <?php
  17. // 获取当前子分类
  18. $cat_id = $_REQUEST['fid'] ?? 47;
  19. // 输出目录
  20. echo get_slider_submenus('service',46,$cat_id)
  21. ?>
  22. </ul>
  23. </div>
  24. </div>
  25. <?php include 'concat.php'; ?>
  26. </div>
  27. <div class="r">
  28. <div class="tit">
  29. <div class="lj">您当前位置 :<a href="/index">首页</a> > <a href="/service">连锁系统</a> > <span><?php echo get_cat_name($cat_id) ?></span></div>
  30. <span><?php echo get_cat_name($cat_id) ?></span>
  31. </div>
  32. <div class="con">
  33. <?php
  34. // 获取该分类下的第一篇文章
  35. $args = array(
  36. 'cat' => $cat_id, // 分类ID
  37. 'posts_per_page' => 1, // 每页显示的文章数量
  38. 'orderby' => 'date', // 按日期排序
  39. 'order' => 'ASC', // 升序
  40. );
  41. $cur_post = get_posts($args);
  42. if ($cur_post) {
  43. $content = $cur_post[0]->post_content; // 文章内容
  44. echo $content;
  45. } else {
  46. echo '文章不存在';
  47. }
  48. // 释放查询结果
  49. wp_reset_postdata();
  50. ?>
  51. </div>
  52. </div>
  53. </div>
  54. <style>
  55. .swiper-wrapper{height:auto;}
  56. </style>
  57. <?php get_footer(); ?>
  58. <script>
  59. jQuery(document).ready(function($) {
  60. $('#contact-form').submit(function(e) {
  61. e.preventDefault();
  62. if($("#rename").val()==''){
  63. alert('请输入姓名!');
  64. return
  65. }
  66. if($("#phone").val()==''){
  67. alert('请输入电话!');
  68. return
  69. }
  70. $.ajax({
  71. url: $(this).attr('action'),
  72. type: 'post',
  73. data: {
  74. action: 'submit_custom_comment',
  75. comment_data: $(this).serialize()
  76. },
  77. success: function(response) {
  78. alert('提交成功!');
  79. $('#contact-form')[0].reset();
  80. },
  81. error: function() {
  82. alert('提交失败,请重试.');
  83. }
  84. });
  85. });
  86. });
  87. </script>
  88. </body>
  89. </html>