list style
-
I’m trying to use
.tassa_soggiorno { list-style-type: square; }but it doesnt work. Maybe it works only if the elements are defined previously as a list by html tags?
The page I need help with: [log in to see the link]
-
The elements you have given this class are not list items. Therefore, no list item is displayed in front of them. If you want to make a list, a list in HTML would be semantically correct. So:
<ul> <li>la locazione dell'appartamento/ casa/ chalet/etc.</li> <li>la commissione per l'agenzia SacconiCase</li> ...ok, but how could I put the <li> to this element?
$asciugamani_esc = '<div class="asciugamani_esc">'. get_the_author_meta( 'asciugamani_esc', $post->post_author ) .'</div>';I don’t see any connection between the code you mentioned and the other one where you should make list points out of it. The class “asciugamani_esc” is only used in the frontend output for a simple text, there are no elements with the class “tassa_soggiorno”.
I have to transform each variable in a list item
i.e.:
$locazione = '<div class="tassa_soggiorno">'. get_the_author_meta( 'locazione', $post->post_author ) .'</div>'; $commissione = '<div class="tassa_soggiorno">'. get_the_author_meta( 'commissione', $post->post_author ) .'</div>'; $consumi = '<div class="tassa_soggiorno">'. get_the_author_meta( 'consumi', $post->post_author ) .'</div>'; $pulizia_inc = '<div class="tassa_soggiorno">'. get_the_author_meta( 'pulizia_inc', $post->post_author ) .'</div>'; $biancheria_inc = '<div class="tassa_soggiorno">'. get_the_author_meta( 'biancheria_inc', $post->post_author ) .'</div>'; $ac_inc = '<div class="tassa_soggiorno">'. get_the_author_meta( 'ac_inc', $post->post_author ) .'</div>';but each variable can have a different class
The variables all have the same CSS class. Thus you can simply
<div class="tassa_soggiorno">replace with
<li class="tassa_soggiorno">and the end
</div>with
</li>Where you output the whole thing, you then surround all the variables with
<ul> .. </ul>Note: these are HTML basics that you put together in PHP. I would recommend you to have another look at these basics. This has little or nothing to do with WordPress.
Not all the variables have the same class
$ac_esc = '<div class="tassa_soggiorno">'. get_the_author_meta( 'ac_esc', $post->post_author ) .'</div>'; $biancheria_esc = '<div class="biancheria_esc">'. get_the_author_meta( 'biancheria_esc', $post->post_author ) .'</div>'; $asciugamani_esc = '<div class="asciugamani_esc">'. get_the_author_meta( 'asciugamani_esc', $post->post_author ) .'</div>';that’s my problem, generating a list items in such a function
Different
<li>items can have different classes. The overall<ul class="li_square">...</ul>container should have the class that establishes the list style.ul.li_square { list-style-type: square; }Please go to Appearance->Customize->Additional CSS option then add that code
.tassa_soggiorno, .biancheria_esc, .asciugamani_esc, .wi_fi_esc, .saldo{ display: list-item; list-style-type: square; }If not work then remove and replace with that code please
.tassa_soggiorno, .biancheria_esc, .asciugamani_esc, .wi_fi_esc, .saldo{ display: list-item !important; list-style-type: square !important; }After that remove extra div please see in the screenshots
Ok, I see it works, I just have to change some div name, another thing, it’s possible to align the round circles (I chosed the circles) exacly under the title? https://test.sacconicase.com/lignano-sabbiadoro-appartamento-centrale-8-posti-nuova-costruzione/
Add a
margin-left: 1.2em;rule to the CSS that Muhammad suggested earlier.For each agency (author), some list items are displayed and other not, so the round circles should be visible only when there is something written aside: https://test.sacconicase.com/marina-di-massa-appartamento-con-due-camere-in-v-licciana/
You need to adjust the output code so if there is no content for a particular item, the related container div mustn’t be output either.
I found a method like this:
div[data-value=""] { display: none }I should add a data value in the div, and than I dont display the div without data value, but my data value is a variable, so..how could I arrange this start?
I tryed with
$suppl_soggiorni_brevi = '<div class="tsogg_brevi" data-value="[suppl_soggiorni_brevi]">'. get_the_author_meta( 'suppl_soggiorni_brevi', $post->post_author ) .'</div>';how should I change the following
.tsogg_brevi , .serv_spiaggia, .imp_cauzione, .suppl_culla, .suppl_animali, .pulizia_esc, .ac_inc, .consumi, .commissione, .locazione, .saldo, .ac_esc{ display: list-item; list-style-type: circle; margin-left: 1.2em; }Hiding with CSS is OK, but you’re still outputting extra HTML that’s not needed. It’s preferable to not output unneeded HTML to start with. The difference in this case is so small that it doesn’t matter much either way. In other cases it could add up to an appreciable amount.
You could manage the output like this:
$suppl_soggiorni_brevi = get_the_author_meta( 'suppl_soggiorni_brevi', $post->post_author ); if ( ! empty( $suppl_soggiorni_brevi)) { $suppl_soggiorni_brevi = '<div class="tsogg_brevi">'. $suppl_soggiorni_brevi .'</div>'; } // repeat as needed for other meta data // finally echo out all the assigned variables as a groupIf you really want to use data-value, you need to construct the PHP correctly:
$suppl_soggiorni_brevi = get_the_author_meta( 'suppl_soggiorni_brevi', $post->post_author ); $suppl_soggiorni_brevi = "<div class=\"tsogg_brevi\" data-value=\"$suppl_soggiorni_brevi\">$suppl_soggiorni_brevi</div>";Then add a new CSS rule set:
.tsogg_brevi[data-value=""] , .serv_spiaggia[data-value=""] /* similar for remaining selectors */ { display: none; }
The topic ‘list style’ is closed to new replies.