Support

Account

Forum Replies Created

  • Hi there,

    Honestly, I don’t remember exactly what I did, but this code works now (I might have had to recreate the fields)

    <?php
    $my_current_lang = apply_filters( ‘wpml_current_language’, null );
    // $queried_object = get_queried_object();
    // var_dump( $queried_object );
    ?>

    <?php
    
    		$loop = new WP_Query(
    			array(
    				'post_type' => 'page',
    				'post__in'  => array( 21 ),
    			)
    		);
    		?>
    <?php
    while ( $loop->have_posts() ) :
    	$loop->the_post();
    	$rolunkbg   = get_field( 'aboutus_bg' );
    	$rolunktext = get_field( 'aboutus_text' );
    
    	?>
    
    <div class="container-fluid bg1 slanted2" style=" background-image:url('<?php echo wp_get_attachment_url( $rolunkbg ); ?>">
        <div class="container tagline">
    
            <h4 class="tagline--description"><?php echo $rolunktext; ?></h4>
    
            <?php endwhile; ?>
            <!-- ;" width="45"> -->
    
            <h2 class="tagline--h2 tagline--transparent">
                <?php
    			if ( $my_current_lang == 'en' ) {
    
    				?>
                <!-- ABOUT US -->
                <?php
    			} else {
    				?>
                <!-- Rólunk -->
                <?php
    			}
    			?>
            </h2>
            <h3 class="tagline--subheadline pt-2 text-center">
                <?php
    			if ( $my_current_lang == 'en' ) {
    				?>
                A professzionális audiovizuális megoldások forrása.
                <?php
    			} else {
    				?>
                A professzionális audiovizuális megoldások forrása.
                <?php
    			}
    			?>
            </h3>
            <h2 class="tagline--h2">
                <?php
    			if ( $my_current_lang == 'en' ) {
    				?>
                <!-- ABOUT US -->
                <?php
    			} else {
    				?>
                <!-- Rólunk -->
                <?php
    			}
    			?>
            </h2>
    
            <?php if ( $my_current_lang == 'en' ) { ?>
            <div class="row">
                <div class="col-3"></div>
                <div class="col-6"><a href="about">
                        <div class="btn-primary text-center">About us</div>
                    </a></div>
                <div class="col-3"></div>
            </div>
            <?php } ?>
    
            <?php if ( $my_current_lang == 'hu' ) { ?>
            <div class="row">
                <div class="col-3"></div>
                <div class="col-6"><a href="rolunk">
                        <div class="btn-primary text-center">Rólunk</div>
                    </a></div>
                <div class="col-3"></div>
            </div>
            <?php } ?>
        </div>
    </div>

    Let me know if it does not help and I’ll check if I needed to change something with the fields in admin.

  • Hi John,

    I managed to fix this issue by installing the “Taxonomy Order” plugin, so the issue is taken care of.

    Thanks for your help and explanation.

  • What would you suggest then? To clarify.

    I have a CPT “Termek”

    This CPT has a Category (also called / sorry for the confusion) of “Termek” which has 5 children

    – Termek 1
    – Termek 2
    – Termek 3
    – Termek 4
    – Termek 5

    I would like to order these based on the $number field so that if say “Termek 5” has an ACF field of $number with the value of 3, it will show up third in the foreach statement. Am I going about this in the wrong way?

    Thanks!

  • Thanks for getting back to me Jarvis. I managed to circumvent the issue by putting this into a function and invoking it after the template part loads. This way the titles do not appear. Nothing appears which is what I was looking for. I’m unsure what caused the issue but it is fine like this for now. Thank you for the tips!

  • Edit: I made a mistake, it does not work either way. 😀

  • Okay. Clarification. I guess I’m missing something deeper. I could not get this code to work, but after I while, I added this the foreach portion of the code to functions.php (I was running this code before in a template-part, that gets loaded to each page, so I thought that would work as well)

    Adding the code to functions.php made the code work. What was I missing?

  • Managed to access date like so:

    $tickerid = $element->ID;
    $ticker = get_field(‘feed_id’, $tickerid );

  • Hi, thanks for the tip.

    This is how I managed to solve it:

    function replacing_template_loop_product_thumbnail() {

    remove_action( ‘woocommerce_before_shop_loop_item_title’, ‘woocommerce_template_loop_product_thumbnail’, 10 );

    function wc_template_loop_product_replaced_thumb() {
    $shop_image = get_field( ‘shop_oldal_kep’ );

    echo ‘</img>’;
    }
    add_action( ‘woocommerce_before_shop_loop_item_title’, ‘wc_template_loop_product_replaced_thumb’, 10 );
    }
    add_action( ‘woocommerce_init’, ‘replacing_template_loop_product_thumbnail’ );

  • Wow that is exactly what I need.

    I will try to implement your answer tomorrow as it’s midnight here.
    If you have your code around by any chance, that would be highly appreciated.

    Thanks a lot!

  • ** EDIT: I just saw that you answered so I’ll read through that. Disregard this answer for now!

    Also, I’m not sure I fully answered your question. Right now the loop is really basic. It takes in cikkek posts and is limited to a certain number of posts based on the layout.

    A picture might help a bit: https://imgur.com/npKU5SL

    The section I’m referring to is “kiemelt hirek”.

    So the top 3 positions are:

    1st loop: Take 1 cikkek post with acf options id from kiemelt 1
    2nd loop: Take 1 cikkek post with acf options id from kiemelt 2
    3nd loop: Take 1 cikkek post with acf options id from kiemelt 3

    I understand that I need to combine the loops somehow, but I’m unsure as to how I can achieve that. I would somehow need to assign

    $top1 = get_field(‘kiemelt1’, ‘option’); a value and order by that value.

    That would fix the looping issue for one, but not the others.

  • Well, currently it does not.

    The options page consists of 9 number input fields.
    Each field contains an ID. ​
    If I change an input ID, the last value disappears (if I could save the last value, that would be a start, but such an option is not available as far as I know).

    It only returns the post ID.

Viewing 11 posts - 1 through 11 (of 11 total)