i have a wordpress plugin where the support is symply bad. this is a plugin for a shuttle service. to book a shuttle, the visitor have to pick a boarding point and a destination point.
both are configured in a list and are used for both select lists. some are used for boarding, other for the destination.
in boarding i want to hide/some items, and this is not possible by any configuration af the plugin.
i hope someone understand my issue. first i give some code how the form is build, then what i have try but it does not work…
first the code:
<div class="mage_input_select mage_bus_boarding_point">
<div class="route-input-wrap"><input id="bus_start_route" type="text" class="mage_form_control" name="bus_start_route" value="Fürth" placeholder="Please Select" autocomplete="off" required=""></div>
<div class="mage_input_select_list" style="display: block;">
<ul>
<li data-route="Bruck a/d Großglocknerstraße"><span class="fa fa-map-marker"></span>Bruck a/d Großglocknerstraße</li>
<li data-route="Führt - Mittersill"><span class="fa fa-map-marker"></span>Führt - Mittersill</li><li data-route="Fürth"><span class="fa fa-map-marker"></span>Fürth</li>
<li data-route="Kaprun"><span class="fa fa-map-marker"></span>Kaprun</li>
<li data-route="Salzburg Flughafen"><span class="fa fa-map-marker"></span>Salzburg Flughafen</li>
<li data-route="Taxenbach"><span class="fa fa-map-marker"></span>Taxenbach</li>
<li data-route="test patrick"><span class="fa fa-map-marker"></span>test patrick</li>
<li data-route="Zell am See"><span class="fa fa-map-marker"></span>Zell am See</li>
</ul>
</div>
</div>
what i want to hide…
<li data-route="Führt - Mittersill"><span class="fa fa-map-marker"></span>Führt - Mittersill</li>
<li data-route="test patrick"><span class="fa fa-map-marker"></span>test patrick</li>
and what i did try for my functions.php file:
function remove_list_items_from_page_content($content) {
$content = preg_replace('/<li data-route="(Führt - Mittersill|test patrick)">.*?</li>/', '', $content);
return $content;
}
function modify_page_content() {
if (is_page(130)) {
$page_content = get_post_field('post_content', 130);
$new_page_content = remove_list_items_from_page_content($page_content);
$new_page_content = wp_kses_post($new_page_content);
wp_update_post(array('ID' => 130, 'post_content' => $new_page_content));
}
}
add_action('wp', 'modify_page_content');
But it is not working, what is wrong?
the page with the form have ID-130 and is my start-page…
I do not know if it is forbidden here to give the url of my develop page?
2
Answers
Thanks for your help and fast response!
like i wrote (i know it is a little complicated) it is a form with two select lists a Boarding list and a destination list, only in my boarding it have to be removed, therefore i try with a function....
first i try it with css, with the classes, i answer my results.... Thanks
THANKS VERRY MUCH!!!!
Why i search for a complicated sollution? i have made it like this:
THANKS AGAIN!
You can use CSS to do that in the following way, using the "data-route" attribute in a selector: