Forum Replies Created

Viewing 15 replies - 31 through 45 (of 104 total)
  • Try putting this in your .htaccess

    DirectoryIndex index.html index.php

    Whatever is first will take priority. You can add as many layers as you want.

    Hmmm. It’s been a few years since I’ve had that same problem. In my history, the resolved thread was here.

    At the end the guy changes his “index.html” to “default.html” and it worked for him. It might be that default gets priority over index. I just can’t remember. But there is a way in the htaccess to prioritize too, just can’t find it right now.

    Sorry for the if’s and but’s and IDK’s but I know it’s possible without changing your index.php

    Maybe you want to use get_the_term_list… just replace “my_custom_tax” with your custom taxonomy.

    $cats_tax = get_the_term_list( $post->ID, 'my_custom_tax', '<li>', ',</li><li>', '</li>') ;
    ?>
    <ul>
    <?php echo $cats_tax ?>
    </ul>
    <?php
    $current_query = $wp_query->query_vars;
    $wp_query = new WP_Query();
    $wp_query->query(array(
    	$current_query['taxonomy'] => $current_query['term'],
    	'posts_per_page' => 10,
    ));
    
    while ($wp_query->have_posts()) : $wp_query->the_post(); ?>

    Which index are you talking about? The theme index or the WordPress index. If you change the WordPress index, your site will not load. One way to use the index.html is to give it priority in your htaccess file while keeping your index.php

    How is the original site created? If it is WordPress, then check out, https://codex.www.ads-software.com/Moving_WordPress

    If it was another CMS, then you’ll have to search. There are some services out there for going from, Joomla or Drupal to get your content over.

    If it was an old static site, you might have to start copying and pasting.

    I think this video is great. He goes into detail about how and queries are loaded and when. It had a couple ah-ha moments for me. It may not answer your specific question, or it might.

    Try this:

    Title:
    <?php single_cat_title( $prefix = '', $display = true ); ?>

    Query:

    <?php
    $current_query = $wp_query->query_vars;
    
    $wp_query = new WP_Query();
    $wp_query->query(array(
    	$current_query['taxonomy'] => $current_query['term'],
    	'paged' => $paged,
    	'posts_per_page' => 10,
    ));
    
    while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
    //...Do Stuff...
    <?php endwhile;  wp_reset_postdata(); ?>

    I think I understand what you’re trying to do.

    You could do a find and replace with your db in an editor that replaces all “wp_” with “whatever_” for your prefix. Just make sure that your config.php reflects the new prefix.

    Ok, please double check, but I think I got it all working.

    First, i put this function into my functions file from this thread: (I’m working with 3 CPT)
    https://www.ads-software.com/support/topic/modifying-author-archive-to-include-custom-post-type-and-pagination?replies=4

    function custom_post_author_archive( &$query )
    {
        if ( $query->is_author )
            $query->set( 'post_type', array( 'filmmaking', 'biology', 'blog' ));
        remove_action( 'pre_get_posts', 'custom_post_author_archive' ); // run once!
    }
    add_action( 'pre_get_posts', 'custom_post_author_archive' );

    Then, my Author.php file looks like this where I add, “author” to the query arguments in a dynamic way.

    <?php
    /**
     * Template for Author
     */
    get_header(); ?>
    
    <div id="page-left">
    
    <?php if ( have_posts() ) : ?>
    
    <?php the_post(); ?>
    <!-- you can put Author header here -->
    <?php  rewind_posts(); //then rewind ?>
    
    <?php
    $author_details = $wp_query->get_queried_object();
    $curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author));
    $temp = $wp_query;
    $wp_query = null;
    $wp_query = new WP_Query();
    $wp_query->query(array(
    	'post_type'=> array('blog', 'filmmaking', 'biology' ),
    	'paged' => $paged,
    	'posts_per_page' => 2,
    	'author' => $author
    ));
    
    	while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
    
    <h2><a href="<?php the_permalink(); ?>">author <?php the_title(); ?></a></h2>
    
    <?php endwhile; endif; wp_reset_postdata(); ?>
    
    <?php untamed_pagi(); ?>
    
    </div><!-- page left -->
    <?php get_footer(); ?>

    Working for me. Hope this helps you.

    I agree. you need to get the CPT in there somehow. I was able to get the pagination to work for my 2 authors and my page template queries by dropping the “if has_posts” But one of the authors gets a 404 after the second page. my code below. Almost there… looking for the same solution ??

    <?php
    $author_details = $wp_query->get_queried_object();
    $curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author));
    $temp = $wp_query;
    $wp_query = null;
    $wp_query = new WP_Query();
    $wp_query->query(array(
    	'post_type'=> array('blog', 'filmmaking', 'biology'),
    	'paged' => $paged,
    	'posts_per_page' => 2,
    ));
    
    while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
    <h2><a href="<?php the_permalink(); ?>">author <?php the_title(); ?></a></h2>
    <?php endwhile;  wp_reset_postdata(); ?>
    Thread Starter Overflow

    (@acrane)

    Well, that’s usually the way it goes. You spend a whole day looking for something and once you post the question, you figure it out.

    Working code for a Custom Post Type paginated on a Custom Page Template: The biggest difference being that there is no, “if have posts” I don’t think I had seen it before but it works.

    <?php
    /**
     * Template Name: pagination test
     */
    
    get_header(); ?>
    <?php //get_sidebar(); ?>
    <div id="page-left">
    <?php
    $wp_query = new WP_Query();
    $wp_query->query(array(
    	'post_type'=>'filmmaking',
    	'paged' => $paged,
    	'posts_per_page' => 2,
    ));
    
    while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
    
    	<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    
    <?php  endwhile; ?>
    <?php wp_reset_postdata(); ?>
    
    <?php previous_posts_link('&laquo; Nyare') ?>
    <?php next_posts_link(' ?ldre &raquo;') ?>
    
    </div><!-- page left -->
    <?php get_footer(); ?>
    Thread Starter Overflow

    (@acrane)

    Fair enough.

    Thread Starter Overflow

    (@acrane)

    Why? How would that help? If that’s what floats your boat, there’s always

    Exactly, I’ve found myself using those resources more these days than the WordPress forums. For me it quickly shifts your attention to the correct answer. For the WordPress forums, it’s like reading a story trying to find out which solution works. There are often many replies that are misunderstood or just plain wrong.

    My opinion, guess it’s not yours. Curious as to why you think it’s a bad idea?

    First thing to try. Pull your ftp back up and navigate to that file. download WP and replace that file (if same version) I’ve had ftp skip a couple files before.

Viewing 15 replies - 31 through 45 (of 104 total)