Forum Replies Created

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter Xen

    (@aloveyu)

    the problem now is I don’t understand where to find my meta key or how to create a meta key

    • This reply was modified 2 months, 3 weeks ago by Xen.
    Thread Starter Xen

    (@aloveyu)

    HI @catacaustic yes exactly, I’m sorry if I didn’t explained it well. since we found what the goal is. I am quite confused where your last code will be inserted? ^^

    I uploaded the PDF file using the Add Media button from the custom post.

    • This reply was modified 2 months, 3 weeks ago by Xen.
    Thread Starter Xen

    (@aloveyu)

    Then I tried your code like this:

    <?php
    $args = array(
    'post_type' => 'post',
    'posts_per_page' => 9,
    'orderby' => 'post_date',
    'order' => 'DESC',
    'post_status' => 'publish',
    );
    $posts = get_posts( $args );
    foreach ( $posts as $post ):
    setup_postdata( $post );
    ?> 
    
    <div class="card text-center">
    <a href="<?php echo esc_url (wp_get_attachment_url (get_the_ID ())); ?>"> 
                                    <?php
                                    $id = get_the_ID();
                                    echo "<p>ID: '".$id."'</p>";
                                    echo "<p>URL: '".wp_get_attachment_url ($id)."'</p>";
                                    ?>
    <?php if (has_post_thumbnail()) : ?>
    <?php the_post_thumbnail('imgResize'); ?>
    <?php else : ?>
    <img src="<?php echo get_template_directory_uri(); ?>/image/general.jp" alt="img" >
    <?php endif; ?>
    </a>
    <p class="date"><?php the_time('Y.m.d'); ?></p>
    <div class="card-body">
    <a  href="<?php the_permalink(); ?>">  
    <p class="card-text">“<?php the_title(); ?>”</p>
    </a>
    </div> 
    </div>
    <?php endforeach; wp_reset_postdata(); ?>  
    Thread Starter Xen

    (@aloveyu)

    here is my code so far:

    <?php
    $args = array(
    'post_type' => 'post',
    'posts_per_page' => 9,
    'orderby' => 'post_date',
    'order' => 'DESC',
    'post_status' => 'publish',
    );
    $posts = get_posts( $args );
    foreach ( $posts as $post ):
    setup_postdata( $post );
    ?> 
    
    <div class="card text-center">
    <a  href="<?php the_permalink(); ?>">  
    <?php if (has_post_thumbnail()) : ?>
    <?php the_post_thumbnail('imgResize'); ?>
    <?php else : ?>
    <img src="<?php echo get_template_directory_uri(); ?>/image/general.jp" alt="img" >
    <?php endif; ?>
    </a>
    <p class="date"><?php the_time('Y.m.d'); ?></p>
    <div class="card-body">
    <a  href="<?php the_permalink(); ?>">  
    <p class="card-text">“<?php the_title(); ?>”</p>
    </a>
    </div> 
    </div>
    <?php endforeach; wp_reset_postdata(); ?>
    Thread Starter Xen

    (@aloveyu)

    Hi @catacaustic yes, I am using the wp_debug and there is no error showing. I tried your last code provided but the PDF file doesn’t open. I only noticed that this code was echoed to the address bar <p>ID:%20'25'</p><p>URL:%20''</<p>ID:%20'25'</p><p>URL:%20''</p>

    Thread Starter Xen

    (@aloveyu)

    sorry I am having difficulties on how the code attached on this post

    • This reply was modified 2 months, 3 weeks ago by Xen.
    Thread Starter Xen

    (@aloveyu)

    Hi @catacaustic thank you for your comment and code however I’ve tried the given code but the output is nothing??? I don’t know if the used of code is right? should I need to replace the
    <a href="<?php the_permalink(); ?>">
    to
    <a href="<?php echo esc_url (wp_get_attachment_url (get_the_ID ())); ?>">

    • This reply was modified 2 months, 3 weeks ago by Xen.
    • This reply was modified 2 months, 3 weeks ago by Xen.
    • This reply was modified 2 months, 3 weeks ago by Xen.
    • This reply was modified 2 months, 3 weeks ago by Xen.
    • This reply was modified 2 months, 3 weeks ago by Xen.
    • This reply was modified 2 months, 3 weeks ago by Xen.
    • This reply was modified 2 months, 3 weeks ago by Xen.
    Thread Starter Xen

    (@aloveyu)

    I already solved my problem. I just need to be careful with my javascript code to not be affect my href # (anchor) link. so I changed some of my javascript code.

    Thread Starter Xen

    (@aloveyu)

    Hi George thank you for your message.
    I’d put the sample codes above on the “About Us” menu tab on my homepage to jump/anchor it to next/other page where the specific <section id=”aboutus”> located. but the problem is, when I tried to click the About Us menu tab it doesn’t work, it didn’t jump to the ID, nothing happened at all.

    I’ve placed the sample codes on my homepage menu tab. I am working with my own custom theme codes.

Viewing 9 replies - 1 through 9 (of 9 total)