Josh
Forum Replies Created
-
Forum: Plugins
In reply to: [Exifography] EXIF data in custom RSS Feed@kristarella, I think I was going about this all wrong. As I’ve done more research, I realized that I don’t need to create a custom RSS, since all the data is there when I view my /feed site. BUT…I can’t figure out how to pull out just the specific EXIF data I want from all the content.
I have this in my page template
<div class="photo-info"> <h3 class="photo-title"><?php echo esc_html( $item->get_title() ); ?></h3> <h3 class="photo-caption"><?php echo esc_html( $item->get_description() ); ?></h3>
But the
get_description()
gives me everything. I’m assuming that I should put something between the perens, but I’m not sure what. I’ve triedexifography_display_exif
but that doesn’t work.Any ideas?
Here’s the full code if it helps:
<?php $feed = fetch_feed('https://www.mysite.com/feed/'); if (!is_wp_error( $feed ) ) : $maxitems = $feed->get_item_quantity( 12 ); $rss_items = $feed->get_items( 0, $maxitems ); endif; ?> <?php function get_first_image_url($html) { if (preg_match('/<img.+?src="(.+?)"/', $html, $matches)) { return $matches[1]; } } ?> <?php if ($maxitems == 0) echo '<li>No items.</li>'; else foreach ( $rss_items as $item ) : ?> <article class="photos"> <a target="_blank"href='<?php echo esc_url( $item->get_permalink() ); ?>'> <div class="photo-image"> <?php echo '<img src="' .get_first_image_url($item->get_content()). '"/>'; ?> </div><!--.photo-image --> <div class="photo-info"> <h3 class="photo-title"><?php echo esc_html( $item->get_title() ); ?></h3> <h3 class="photo-caption"><?php echo esc_html( $item->get_description() ); ?></h3> </div><!--.photo-info --> </a> </article> <?php endforeach; ?>
I want
get_description
to display my camera, focal_length, shutter_speed, and aperture.Thanks.
- This reply was modified 4 years, 5 months ago by Josh.
Forum: Plugins
In reply to: [Exifography] EXIF data in custom RSS FeedI don’t know anything about coding…I’m trying to teach myself ??
I found a tutorial that had the code to put into the function.php file and then the code for the rss-myrssfee.php file. Now I’m just tinkering to get the EXIF data.
So I put the code above into the functions file, but how do I actually call it in the rss file? I’m thinking the tag can be anything so
<exif> </exif>
would work? but what do I put between to actually get it to work? I’ve triedexifography_display_exif
andcustom_add_exif_to_feed
and neither worked.Thanks.
Forum: Plugins
In reply to: [Exifography] EXIF data in custom RSS Feed@kristarella, thanks for the quick response. That’s correct. I have the EXIF data in a widget, so the only thing in the post itself is the image. I’m trying to use the RSS feed to drop some of my pictures into another website, but I want to include the EXIF data of those pics.
I’ve learned how to create a custom rss feed, but I can’t figure out how to tell it to include the EXIF data within that custom RSS feed.
Forum: Plugins
In reply to: [Cornerstone] customizing permalinksThanks. So I was on the right path…that makes me feel better. This is what I did originally before submitting the help request. But I’m still having an issue. Here’s what I put into the custom permalink field:
/%postpath%/%year%/%monthnum%/%postname%/
but I get a 400 error and this is what’s in the URL window:
https://mysite.com/%postpath%/2020/07/my_blog_post/
When I select the Structured permalink option, it works fine (
https://mysite.com/blog/my_blog_post/
).I’m thinking that wordpress is only recognizing %postpath% when I select the “Structured” permalink option.
Forum: Plugins
In reply to: [Cornerstone] customizing permalinksThanks. I’m sorry…I’m not very proficient in wordpress, so forgive me if I’m not asking the right question (or if I’m not understanding the answer). I understand how to use the tags to customize my permalink. What I don’t know is what tag to use to get the name of the section I created to display in the URL like your “Structured” default does.
I can create a custom permalink like this:
/%year%/%monthnum%/%postname%/
, but I don’t know what tag to put before /%year%/ for it to display the structure section names.Does that make sense?
Forum: Plugins
In reply to: [Cornerstone] customizing permalinksThanks for the email. I actually meant that I wanted to keep the permalink how “Structured” formats it, but i wanted to add so instead of
site.com/section-name/sample-post/
as “Structured” formats it it would be something likesite.com/section-name/year/month/sample-post/
so it has the section name at the beginning like “Structured” does, but it also has additional info before the post’s name.thanks.
Forum: Fixing WordPress
In reply to: hiding a category namethanks for the reply. Just for clarity, I’m only trying to hide specific category names from appearing in the list of categories (or tags in the list of tags if that’s wiser) that appear on a page or post. I’m not trying to exclude the post itself. So if there are 4 categories for a specific post, I only want 3 of them listed and the 4th to be hidden. So let’s say I have a post that’s all about pets, and I add “pets,” “dogs,” and “animals” categories. But I also want to add “weekly feature” as a category so I can easily find it and also to have it show in a specific section. I don’t necessarily want my viewers to see this category appear in the list of categories, but I still want them to see the post and the other categories. So, I’d like to hide just “weekly feature” from the list that appears at the bottom of the post.
Thanks.
Forum: Themes and Templates
In reply to: [Camer] pages automatically appearing on menunever mind…I forgot to create a custom menu.
- This reply was modified 4 years, 9 months ago by Josh.
Forum: Fixing WordPress
In reply to: Hiding empty widgetI just checked the source code… no reference to the title and as far as i can tell no errors on this topic. I did find this, but not sure it’s apropos:
Uncaught (in promise) Error: You must pass a
userId
oranonymousId
key
at Object.t.default (content.bundle.js:6)
at t.identify (content.bundle.js:6)
at content.bundle.js:1Forum: Fixing WordPress
In reply to: Hiding empty widgetThe actual title doesn’t really matter until I get it to work ?? but I did try only one = and that still didn’t fix the problem.
Forum: Fixing WordPress
In reply to: Hiding empty widgetyea…that is all way beyond by knowledge level.
so, I updated per your edits and now have this:
add_shortcode( 'widget_exif' , 'exif_outside_loop' ); function exif_outside_loop() { global $wp_query; $post_ID = $wp_query->post->ID; $img = get_post_thumbnail_id($post_ID); $exif ==''; if (function_exists ('exifography_display_exif')) { $exif = exifography_display_exif($img); if ( !empty($exif) ) $exif = '<h3>Exif title</h3>' . $exif; } return $exif; } add_filter('widget_text', 'do_shortcode');
the good news is that the widget disappears when there is no EXIF data, but the title doesn’t appear when there is. Any thoughts?
Forum: Fixing WordPress
In reply to: Hiding empty widgetthanks.
the shortcode I have is
[exif show="camera,focal_length,shutter_speed, aperture,iso,flash,location"]
If you can tell me how that can make it so there is no title when there is no data, that would be great. But you suggested writing a shortcode, so I was able to find what I posted above, and hopefully if I can figure out how to add what you just gave me, it will work the way I want.
As I stated, I don’t know anything about this stuff…I’m just trying to figure it out as I go. I have no education or training in coding.If there is an easier way to make this work, I’m very interested to know.
- This reply was modified 4 years, 9 months ago by Josh.
Forum: Fixing WordPress
In reply to: Hiding empty widgetOK, so digging around the plugin’s forum, I did in fact find some coding to create a shortcode, but it doesn’t have anything to create a title within the widget. Can you help me out with that bit of coding? Then I think I’ve got it.
Here’s what I have so far:
// creates a shortcode to show EXIF outside the loop add_shortcode( 'widget_exif' , 'exif_outside_loop' ); function exif_outside_loop() { global $wp_query; $post_ID = $wp_query->post->ID; $img = get_post_thumbnail_id($post_ID); if (function_exists ('exifography_display_exif')) echo exifography_display_exif($img); } // enables shortcodes within widgets add_filter('widget_text', 'do_shortcode');
Forum: Fixing WordPress
In reply to: Hiding empty widgetThe shortcode I put in is from the plugin…it just lists the EXIF data from the image in the post. The plugin doesn’t have it’s own widgets, so I just copied and pasted the shortcode into the text widget that’s built into WordPress. It doesn’t seem that the plugin has any additional shortcodes to control anything beyond printing the EXIF data.
I have no idea how to create a shortcode.
It seems that I will not be able to get it to do what I wanted it to. Oh, well. I really thought this would be a lot simpler than it appears to be.
Forum: Fixing WordPress
In reply to: Hiding empty widgetThis is a bit complicated. I had assumed there was some kind of if/then statement (if there is data in the widget, then print title, otherwise no title), but if I’m understanding what you are saying there is no way for WordPress to know if there is info in the widget, so it will always print the title.
to get around this, don’t put in a title in the Widgets section of the admin menu and just put it in the body of the widget itself by using a shortcode.
if that is correct, how do i know what the shortcode is?