Forum Replies Created

Viewing 15 replies - 1 through 15 (of 30 total)
  • Thread Starter gfaw

    (@gfaw)

    I tried it on a “real” server, and it works without fuss. As I’m running XAMPP on Windows I suspect it is due to the 260 character limitation in paths in Windows. :[

    Thread Starter gfaw

    (@gfaw)

    Thanks Michael!

    Meanwhile I’ve figured that out myself.

    Main issue had been the page navigation – the buttons, as the default WP logic is diametrially opposite to conventional logic (that is, first comes first and last comes last).

    In that way I swapped the buttons over, making the PREV-button a NEXT-button and vice versa:

    Original code:

    <?php if ($wp_query->max_num_pages > 1) : ?>
      <nav class="post-nav">
        <ul class="pager">
          <li class="previous"><?php next_posts_link(__('&larr; Back', 'roots')); ?></li>
          <li class="next"><?php previous_posts_link(__('Forward &rarr;', 'roots')); ?></li>
        </ul>
      </nav>
    <?php endif; ?>

    My code:

    <?php if ($wp_query->max_num_pages > 1) : ?>
      <nav class="post-nav">
        <ul class="pager">
          <li class="previous"><?php previous_posts_link(__('&larr; Back', 'roots')); ?></li>
          <li class="next"><?php next_posts_link(__('Forward &rarr;', 'roots')); ?></li>
        </ul>
      </nav>
    <?php endif; ?>

    Basically my first approach was way too complicated until it dawned on me. Not a plugin issue though, but somebody might find it helpful.

    Thread Starter gfaw

    (@gfaw)

    Some might point out WPML – I also tried that in the past, but found it very complex and time consuming depending what you want to achieve.

    Thread Starter gfaw

    (@gfaw)

    It works!!! That is so awesome! Thanks a million!

    Thread Starter gfaw

    (@gfaw)

    OK, I was a bit too quick trying to pull the template in the while-loop. When I use the_title(); it actually outputs the manes of the writers!

    Thread Starter gfaw

    (@gfaw)

    Thanks for praise – learning a little every day ??

    So now it does something. It outputs Autoren nach Publikation (“writers by publication”) which is the title of this page to list the posts. And it does it in a way, as to if there is one writer one line is output and if there are 3 it outputs three lines.

    As for the rest:
    I removed the no posts/search bit.

    Breadcrumbs: I’m using the Breadcrumbs Nav XT plugin, this is just a bit of default code. I tried with temporarily removing the statement – made no difference. So I guess, there’s no issue here.

    Thread Starter gfaw

    (@gfaw)

    Agreed on the terminology ?? My native language is German and while my command of English is decent, it might give me issues with professional terminologies.

    As for the theme: roots is a Starter theme to build upon, no need to create a child theme.

    So far I have successfully created a page and linked to it – Works great!

    Now the query gives me some trouble…

    This is the code of the template, basically it’s the code of a default page template more or less.

    <?php
    /*
    Template Name: Autoren nach Publikation Template
    */
    ?>
    
    <?php get_template_part('templates/breadcrumbs'); ?>
    
    <?php if (!have_posts()) : ?>
      <div class="alert alert-warning">
        <?php _e('Sorry, no results were found.', 'roots'); ?>
      </div>
      <?php get_search_form(); ?>
    <?php endif; ?>
    
    <?php while (have_posts()) : the_post(); ?>
      <?php get_template_part('templates/content-publikationen-neuerscheinungen'); ?>
    <?php endwhile; ?>

    So that’s what I came up with, but it’s not working.

    <?php
    /*
    Template Name: Autoren nach Publikation Template
    */
    ?>
    
    <?php get_template_part('templates/breadcrumbs'); ?>
    
    <?php if (!have_posts()) : ?>
      <div class="alert alert-warning">
        <?php _e('Sorry, no results were found.', 'roots'); ?>
      </div>
      <?php get_search_form(); ?>
    <?php endif; ?>
    
    <?php 
    
    	$terms = get_terms( array( 'autoren' ) );
    
    	foreach ( $terms as $term ){
    
        $term = get_posts( array( 'post_type' => 'autoren' ));
    
        // If there was an error, continue to the next term.
        if ( is_wp_error( $term_link ) ) {
            continue;
        }
    
    while (have_posts()) : the_post();
     get_template_part('templates/content-single-autoren');
    endwhile;
    }
    ?>

    What am I doing wrong?

    Thread Starter gfaw

    (@gfaw)

    As for buttons and the theme:

    I’m building on the roots theme and twitter bootstrap, though this is not theme related, I believe.

    The code of a button would look like this:
    <a class="btn btn-default hidden-lg" href="<?php echo get_post_type_archive_link( 'autoren' ); ?>" role="button">Mehr über den Autor</a>

    The same button is used on the PUBLIKATIONEN single and archive pages.

    Thread Starter gfaw

    (@gfaw)

    I found some code which might go in the right direction:

    $terms = get_the_terms_list( 'autoren' );
    
    echo '<ul>';
    
    foreach ( $terms as $term ) {
    
        // The $term is an object, so we don't need to specify the $taxonomy.
        $term_link = get_term_link( $term );
    
        // If there was an error, continue to the next term.
        if ( is_wp_error( $term_link ) ) {
            continue;
        }
    
        // We successfully got a link. Print it out.
        echo '<li> </li>'; // use single-autoren page template
    }
    
    echo '</ul>';

    Output:
    something that can be used within a link such as:

    <a href="<?php get_listing_link_for_terms( $post->ID, 'autoren'); ?>">Link to associated writers listing page</a>

    Thread Starter gfaw

    (@gfaw)

    Hi bcworkz,

    first of all thank you for taking an interest in my problem and trying to help – greatly appreciate this!

    The CPT PUBLIKATIONEN has a custom Taxomony called AUTOREN which has Terms the names of the writers. They would resemble tags in the default WP taxonomy sceme.

    CPT AUTOREN only has terms, the names of the writers which resemble a post for each name.

    The slug is the same in both: https://www.example.com/autoren/<writer-name&gt; (as long as I use the same slug in both when I create the entry, of course!)

    Unfortunately I have it not online yet, but perhaps some screenshots will make is clearer?

    Screenshots

    On the PUBLIKATIONEN listing page you see the button “Mehr über den Autor” – clicking this should bring up a list of writers profiles associated to the post. I’ve scrolled down a bit for the screenshot so to make clear that individual PUBLIKATIONEN posts have only one others have 3 or even more contributors

    Thread Starter gfaw

    (@gfaw)

    I’m pulling the AUTOREN (writers of a specific Publication) into the post with the following code:

    <?php
    echo '<ul class="publikationen-list-autoren">';
    echo get_the_term_list( $post->ID, 'autoren', '<li>', '</li><li>', '</li>' );
    echo '</ul>';
    ?>

    What I require is 2 things:
    1. I need to list all writer’s profiles assigned to a certain PUBLIKATIONEN post with a, I think, custom query that relates both entities but I don’t really know much about setting this up
    2. I need to configure a link which I can use with a button, so that when the button is clicked the user is taken to a listing page. Say the PUBLIKATIONEN post has 3 writers, the user will be taken to a page listing these 3 profile posts

    Though I believe that the slug of each the CPT AUTOREN term and the CPT PUBLIKATIONEN taxonomy AUTOREN term are equal and therefore the permalinks work.

    Forum: Hacks
    In reply to: From Bootstrap to WordPress
    Thread Starter gfaw

    (@gfaw)

    The client is a client of a graphics designer, both with next to no web knowledge. I sold them the benefits, which are ease of administration and legal issues basically. But they do not sell enough that there would be a ROI any time soon. Then I suggested to have them write a simple email if they just sell a book or two a month. But this isn’t fancy enough… The cost for the plugin is not the problem rather the customizing it takes… Well, what can I say…

    Thread Starter gfaw

    (@gfaw)

    I know this might sound weird.

    What I’m trying to achieve is to set up some order capability for a customer. Basically the customer has a 100 something books and doesn’t want to invest in a decent web shop. On their current website they solved it with a html form with a dropdown menu while the form is then sent via email client. Not elegant, let alone functional due to lack of multi-item selection. But this is how the customer wants it…

    Now I’m looking for a better way to accomplish this order process.

    I thought of using a form, so when the user clicks the item’s order button, the book title is transferred to the subject field.

    Thread Starter gfaw

    (@gfaw)

    Problem is, there are not just 2 buttons. I would need to create 100+ forms if I would do it that way, so I was looking for a way how to do it more elegantly.

Viewing 15 replies - 1 through 15 (of 30 total)