Forum Replies Created

Viewing 15 replies - 1 through 15 (of 34 total)
  • Thread Starter monkeybrain

    (@monkeybrain)

    Hi Jacob,

    Yes, thanks, got it working.
    (Had to save the customizer settings afterwards as the search and replace in the theme files also renamed the custom css filename the theme writes. Doh!)

    Cheers

    Thread Starter monkeybrain

    (@monkeybrain)

    Hi Jacob,

    Thanks! I know where the customizer options are stored. Replacing the old theme name with the new one, did not result in all options being used correctly by the renamed theme though. I might have to manually look into the options that do not migrate as expected. Maybe I made a mistake while renaming.

    Any news on this feature? Or does someone has a solution to get srcset into the meta slider via functions.php?

    Thread Starter monkeybrain

    (@monkeybrain)

    Hey @bcworkz,

    Thanks a lot! I’ll give it a try but am not great with frustrating moments and might end up hiring someone to help me with this. ??

    Thread Starter monkeybrain

    (@monkeybrain)

    Marking this as resolved, but feel free to let me know of a better solution using WP_Query.
    Thanks!

    Thread Starter monkeybrain

    (@monkeybrain)

    I found a solution! When I put this into my taxonomy-photo.php it displays the correct posts from the photo cpt.

    <?php $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); ?>
    <?php query_posts(array( 'post_type'=>'photo', 'gallery'=>$term->slug)); ?>
    <?php if ( have_posts() ): ?>
    <?php while ( have_posts() ) : the_post();?>

    The only thing I’m not sure about is using query_posts since I read somewhere that it shouldn’t be used. But a quick try with WP_Query did not work. If someone has a solution that works with WP_Query, let me know.

    Cheers and thanks again for the help.

    Thread Starter monkeybrain

    (@monkeybrain)

    Hi TrishaM,

    Thanks for your reply! And thanks for the compliment regarding my English skills. Whenever misunderstandings happen I tend to think it’s because of not being a native English speaker.

    1. Oddly enough, my query above worked even without defining the_post, but it wasn’t dynamic and only worked for the defined term ‘black-and-white’.

    2. First off, I followed your advice and renamed the cpt to photo and also renamed the taxonomy to gallery … I then tried to find the problem with the normal

    <?php if ( have_posts() ): ?>
    <?php while ( have_posts() ) : the_post(); ?>

    approach. And while trying to find the problem I thought I’d test the custom taxonomy for normal posts and see if that works, and to my surprise it does.
    So, when I change

    register_taxonomy( 'gallery', 'photo',
        	array(

    to

    register_taxonomy( 'gallery', 'post',
        	array(

    the taxonomy-gallery.php template works as expected (using the normal WP posts).
    When I try to use it for the cpt photo it doesn’t.

    Now I wonder if the solution could be to tell the taxonomy-gallery.php loop to somehow use the post_type ‘photo’ and not ‘post’. (Even after changing register_taxonomy( 'gallery', 'post', back to register_taxonomy( 'gallery', 'photo', the page still displays the posts. It really seems like it is only looking for posts and not post_type photo at all.

    Do you have any ideas on how to get the attention of a mod?

    Thanks a lot! I feel like I’m really close to the solution. ??

    Thread Starter monkeybrain

    (@monkeybrain)

    Hi TrishaM,

    Thanks a lot, but if I understand correctly this is not exactly what I’m trying to do. I’m trying to create multiple photo galleries, each with its own url/page.

    I actually have an archive-photos.php with a query very similar to your code, except the ‘posts_per_page’ => 1, … this page will be used as an overview of all terms/galleries, from there I link to < a href=”/photo-gallery/<?php echo $tax_term->slug; ?>/” on the most recent photo thumbnail within that term. This terms/galleries overview will be found under /photos/ (Because there the user finds all photos is why I called the CTP photos and not photo, your reasoning makes sense though)

    What I’m now trying to do is a template file that lists the photos from within ONE term, so if I understand correctly, no foreach($terms as $term). It should work like /tag/black-and-white/ or /category/black-and-white/ works for normal WordPress posts.

    What confuses me is that the normal tag.php or category.php of WordPress uses a simple

    <?php if ( have_posts() ): ?>
    <?php while ( have_posts() ) : the_post(); ?>
    <?php endwhile; ?>
    // Content like <?php the_title(); ?> etc...
    <?php else: ?>
    	No posts to display
    <?php endif; ?>

    but if I use this for my custom taxonomy and browse to /photo-gallery/black-and-white/, it returns “No posts to display”.

    And with my code

    <?php $term_loop = new WP_Query( array(
        'post_type' => 'photos',
        'photo-gallery' => 'black-and-white',
        )
      );
    ?>
    <?php the_thumbnail() ?>
    <?php endwhile; ?>

    the taxonomy-photo-gallery.php returns all photos within the term ‘black-and-white’. That’s why I thought if I could replace that line with something that grabs the term name from the URL, it would work for all terms (/photo-gallery/black-and-white/ aswell as /photo-gallery/portrait/ and all other terms/galleries.)

    Any ideas on how to solve that?
    And sorry if my explanation is not clear, English is not my first language.

    Thanks so much for your help!

    edit: This is the code I use to create the custom taxonomy, maybe there is something wrong with it?

    function build_photo_taxonomies() {
        register_taxonomy( 'photo-gallery', 'photos',
        	array(
        		'label' => 'Gallery',
                'public' => true,
        		'hierarchical' => true,
        		'query_var' => true
        		)
        	);
    }

    Thread Starter monkeybrain

    (@monkeybrain)

    Hi TrishaM

    Thanks for your reply!

    1. Sorry about that, makes sense, thanks.

    2. I have a custom post type named ‘photos’ which has a custom taxonomy called ‘photo-gallery’. For each taxonomy term (e.g. ‘black and white’, ‘portrait’, etc…) I’d like to have an overview which lists all photos that are within that term.

    So, what I’m trying to do is list all photos that are tagged with ‘black-and-white’ but also not hardcode the name of the tag, so that the template file works with all future tags/terms.
    I first thought that I could use

    <?php if ( have_posts() ): ?>
    <?php while ( have_posts() ) : the_post(); ?>

    because I thought taxonomy-photo-gallery.php is associated with all the terms that I create within the taxonomy ‘photo-gallery’, but that does not seem to work as expected. So I tried and looked around on how to return the photos for one term and then go from there and adapt it for all other terms.

    If you see my mistake in code or thinking, any help would be greatly appreciated.

    Thanks!

    And if your theme offers user-added CSS or you installed a CSS plugin, the CSS to change the font size looks like this:

    h2 {
    font-size: 20px;
    }

    And change the 20px until you like its size.

    Thread Starter monkeybrain

    (@monkeybrain)

    I still haven’t found a solution for this. If someone has an idea, help would be very much appreciated.

    Thanks!

    I was looking for a solution for this too, and found this solution that seems to work fine:

    https://pippinsplugins.com/retrieve-attachment-id-from-image-url/

    There are quite a few plugins that let you import from an RSS feed. Unfortunately there are only a limited number of posts in an RSS feed.
    https://www.ads-software.com/plugins/search.php?q=import+rss

    Maybe there is an export function for your Goodreads? Maybe even contact them and ask for help, maybe they can send you an XML or JSON file with your content? WordPress can import quite a few different formats. https://codex.www.ads-software.com/Importing_Content#Importing_from_.5BX.5DHTML

    Maybe this helps? https://www.goodreads.com/help/show/5-how-do-i-import-or-export-my-books
    Or this: https://fictionvixen.com/how-to-back-up-export-your-goodreads-library-in-case-you-want-to-move-it/ (WordPress can import CSV)

    It looks like your theme is showing the excerpt of the post and therefore not displaying the images from the content. Assigning featured images, like deepbevel suggested, probably is the right solution indeed.

    Thread Starter monkeybrain

    (@monkeybrain)

    Add some if custom field is not empty return some html and it’s even more yikes.
    I’m glad and astonished that I was able to help and simplify. (Even though I just followed your link.) ??

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