Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter DesignCDdev

    (@designcddev)

    Really the main problem here is that WordPress is not designed to support the kind of object oriented approach to building a site/application that has a number of different data models that have parent-child relationships. But if someone has a good solution that doesn’t require a plugin or creating “fake pages”, I’d love to hear it. End rant.

    Thread Starter DesignCDdev

    (@designcddev)

    @thescube I’ll check out the article, looks like it might be a solution to this issue. I personally don’t know much about the rewrite api, so for the time being I try to avoid using it until I learn more about how it actually works.

    The solution I used was to install a plugin named Timber and I used the routing capabilities that come along with it. You can read about it here. Basically, how routing works is you assign templates to url patterns.

    For all I know, that might be what the article is describing.

    Thread Starter DesignCDdev

    (@designcddev)

    Was able to fix it using this code instead, couldn’t figure out what was wrong though. Been coding too long to see what I’m getting wrong…

    <?php $query = new WP_Query('category_name=press-release&showposts=15'); ?>
          <?php while ($query->have_posts()) : $query->the_post(); ?>
            <div class="BlogPost pr">
              <?php
                $image = get_field( 'pr_image' );
                if ( !empty($image) ): ?>
                  <img class="press-release-image"
                       src="<?php echo $image['url']; ?>"
                       alt="<?php echo $image['alt']; ?>">
              <?php endif; ?>
              <span class="BlogPost-meta-date">
                <?php the_date("F j, Y"); ?>
              </span>
              <a href="<?php the_field( 'pr_outgoing_link' ); ?>">
                <h2 class="BlogPost-title">
                  <?php the_title(); ?>
                </h2>
              </a>
            </div><!-- .BlogPost -->
    
          <?php endwhile; ?>
Viewing 3 replies - 1 through 3 (of 3 total)