Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Nowicjusz vs. PHP, Strona na Wordpressie
Merol
post
Post #1





Grupa: Zarejestrowani
Postów: 6
Pomógł: 0
Dołączył: 3.07.2015

Ostrzeżenie: (0%)
-----


Witam, znalazłem darmowy szablon php na Wordpress i zacząłem zabawę próbując dostosować go do swoich potrzeb.

Zacznę od podania linku do mojej strony na testowej domenie: http://agencjafresh.esy.es/
Chciałbym w wyszukiwarce ofert zastąpić "Type, Rooms, Area, Price" innymi słowami, z tym, że Price chciałbym ręcznie wpisywać od / do.

Próbowałem zmienić kolejno "Type" na "Typ transakcji" wszędzie w kodzie, ale wtedy wyszukiwarka się psuła. Być może dlatego, że słowo jest dwuczłonowe, ale nie jestem pewien.

Tak wygląda w tych miejscach kod:
functions.php
  1. function listings_taxonomy() {
  2. register_taxonomy(
  3. 'type',
  4. 'listings',
  5. 'hierarchical' => true,
  6. 'label' => 'Type',
  7. 'query_var' => true,
  8. 'rewrite' => array('slug' => 'type')
  9. )
  10. );

searchs-listings-form-sidebar.php
  1. <div class="sidebar-box search-listings <?php echo (is_page_template('home-page-template.php')) ? 'transp' : '';?>">
  2. <h3>Znajdź swój nowy dom:</h3>
  3. <form method="post" action="<?php bloginfo('url');?>/listing-search-results/">
  4. <div><?php echo buildSelect('type'); ?></div>
  5. <div><?php echo buildSelect('rooms'); ?></div>
  6. <div><?php echo buildSelect('area'); ?></div>
  7. <div><?php echo buildSelect('price'); ?></div>
  8. <div><input type="submit" class="button" /></div>
  9. </form>
  10. <div class="clear"></div>
  11. </div>

searchs-listings-form.php
  1. <div class="twelve columns listing-search">
  2. <h3>Możesz filtrować bazę ofert za pomocą poniższych pól wyboru:</h3>
  3. <div class="search-wrap <?php echo (is_page_template('home-page-template.php')) ? 'transp' : '';?>">
  4. <form method="post" action="<?php bloginfo('url');?>/listing-search-results/">
  5. <div class="two columns"><?php echo buildSelect('type'); ?></div>
  6. <div class="three columns"><?php echo buildSelect('rooms'); ?></div>
  7. <div class="three columns"><?php echo buildSelect('area'); ?></div>
  8. <div class="two columns"><?php echo buildSelect('price'); ?></div>
  9. <div class="two columns"><input type="submit" class="button" /></div>
  10. </form>
  11. </div>
  12. </div>

single-listings.php
  1. <div class="overview">
  2. <h6>Specyfikacja techniczna</h6>
  3. <ul>
  4. <?php echo get_the_term_list( $post->ID, 'type', '<li>Type: ', ', ', '</li>' ); ?>
  5. <?php echo get_the_term_list( $post->ID, 'rooms', '<li>Rooms: ', ', ', '</li>' ); ?>
  6. <?php echo get_the_term_list( $post->ID, 'area', '<li>Area: ', ', ', '</li>' ); ?>
  7. <?php echo get_the_term_list( $post->ID, 'price', '<li>Price: ', ', ', '</li>' ); ?>
  8. <li><a href="#respond">Contact Us</a> regarding this listing</li>
  9. </ul>
  10. </div>
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
rafalp
post
Post #2





Grupa: Zarejestrowani
Postów: 224
Pomógł: 18
Dołączył: 4.02.2003
Skąd: Częstochowa

Ostrzeżenie: (0%)
-----


Znajdź funkcję buildSelect() i grzeb dalej, te słowa w polu "select" powinny pochodzić z pliku z tłumaczeniem (.mo/.po/.pot)
Go to the top of the page
+Quote Post
Merol
post
Post #3





Grupa: Zarejestrowani
Postów: 6
Pomógł: 0
Dołączył: 3.07.2015

Ostrzeżenie: (0%)
-----


Cytat(rafalp @ 3.07.2015, 22:27:36 ) *
Znajdź funkcję buildSelect() i grzeb dalej, te słowa w polu "select" powinny pochodzić z pliku z tłumaczeniem (.mo/.po/.pot)

Bardzo dziękuję za odpowiedź! Niestety, nie było żadnego tłumaczenia, sam wszystko przetłumaczyłem. Tak wygląda funkcja buildSelect(). Jak mam ją zmienić?

function buildSelect($tax){
$terms = get_terms($tax);
$x = '<select name="'. $tax .'">';
$x .= '<option value="">Select '. ucfirst($tax) .'</option>';
foreach ($terms as $term) {
$x .= '<option value="' . $term->slug . '">' . $term->name . '</option>';
}
$x .= '</select>';
return $x;
}

Ten post edytował Merol 3.07.2015, 21:38:18
Go to the top of the page
+Quote Post
rafalp
post
Post #4





Grupa: Zarejestrowani
Postów: 224
Pomógł: 18
Dołączył: 4.02.2003
Skąd: Częstochowa

Ostrzeżenie: (0%)
-----


Cytat(Merol @ 3.07.2015, 22:37:53 ) *
function buildSelect($tax){
$terms = get_terms($tax);
$x = '<select name="'. $tax .'">';
$x .= '<option value="">Select '. ucfirst($tax) .'</option>';
foreach ($terms as $term) {
$x .= '<option value="' . $term->slug . '">' . $term->name . '</option>';
}
$x .= '</select>';
return $x;
}


Jeśli to ta funkcja (bo nie jestem pewien gdyż jest napisane "Select" zamiast "[wybierz]" (?)
ale jeśli tak to 'proteza' będzie taka:

  1. function buildSelect($tax){
  2. $terms = get_terms($tax);
  3. $x = '<select name="'. $tax .'">';
  4.  
  5. $tax_pl = $tax;
  6. if($tax == 'type')
  7. {
  8. $tax_pl = 'typ';
  9. }
  10. if($tax == 'rooms')
  11. {
  12. $tax_pl = 'pokoje';
  13. }
  14. if($tax == 'area')
  15. {
  16. $tax_pl = 'region';
  17. }
  18. if($tax == 'price')
  19. {
  20. $tax_pl = 'cena';
  21. }
  22. // lub IF-ELSE
  23.  
  24.  
  25.  
  26. $x .= '<option value="">Select '. ucfirst($tax_pl) .'</option>';
  27. foreach ($terms as $term) {
  28. $x .= '<option value="' . $term->slug . '">' . $term->name . '</option>';
  29. }
  30. $x .= '</select>';
  31. return $x;
  32. }


Ten post edytował rafalp 4.07.2015, 10:15:08
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 13.10.2025 - 21:30