Forum Replies Created
-
AuthorPosts
-
amandathewebdev
MemberHi Brad,
Thanks for the suggestion, but isn't it best not to modify parent files? Can I achieve the same thing with a hook or filter?
amandathewebdev
MemberThank you very much! With your help I figured it out!
amandathewebdev
MemberHi Victor,
Thank you for the response 🙂 I don't see my child child theme in Appearance > Themes in my main site either. Just Genesis and Epik, but no Kidz.
I'm not sure what you mean by renaming the theme's text domain, do you mean renaming the folder or what I did in functions.php? I want to be able to differentiate it between the other themes. They are all named Epik but are all custom.
amandathewebdev
MemberOK I figured it out with (a lot of) help from a co-worker. If anyone stumbles across this, this is what I did, all in my functions.php:
function get_src() { if ( has_post_thumbnail() ) { $src = wp_get_attachment_image_src( get_post_thumbnail_id(), 'thumb' ); $fbimage = $src[0]; } else { global $post, $posts; $fbimage = ''; $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches); $fbimage = $matches [1] [0]; } if(empty($fbimage)) { $fbimage = site_url().'/wp-content/themes/epik/img/logo.png'; } return $fbimage; } add_filter('genesis_get_image', 'default_image_fallback', 10, 2); function default_image_fallback($output, $args) { return get_image(); } function get_image($class="") { $src = get_src(); ob_start()?> <a href="<?php echo get_permalink() ?>"> <img class="featured-image <?php echo $class ?>" src="<?php echo $src ?>" alt="<?php echo get_the_title() ?>" /> </a> <?php return ob_get_clean(); }
amandathewebdev
MemberIf I add
add_action( 'genesis_get_image', 'get_image', 3 );
then I see the img URL text next to every blog post. Not an image, but it's something.amandathewebdev
MemberThanks for the suggestion. Unfortunately it didn't work.
December 21, 2015 at 3:48 pm in reply to: Using a non-genesis theme with the genesis framework #174510amandathewebdev
MemberHi Tom,
Thank you for the link. I bookmarked it and will definitely check them out for my next project. I didn't find this site when I was Googling Genesis Woocommerce themes. Anywho it is still limited, only 35 with woocommerce while on themeforest and other WP theme sites there are hundreds. Unfortunately they aren't Genesis.
The themes on the link you provided are very nice but won't work for the project I'm currently working on. But like I said I will definitely check this out for the next one. I want to see more! 🙂
amandathewebdev
MemberThanks for the reply carrieoke13. That code threw an error for me though.
My code is working but not on the posts I migrated. I think the issue might be that the images were not uploaded into THIS particular WP install. Even though the folders exist under
wp-content > uploads
with the images inside, they are not a part of the media library. The images I upload to the media library pull correctly if no featured image.Why is that the case? Very weird. So maybe I should treat these images as external linked images? How would I pull those?
amandathewebdev
MemberReally? Nice!
amandathewebdev
MemberHi guys,
Thanks for chiming in. I re-installed WP 4.3 via the dashboard and that seemed to do it for some reason. I have no idea what happened but that did the trick.
amandathewebdev
MemberThank you for looking! No, I have an iPhone 4s and this is what I'm seeing: http://caringheart.staging.wpengine.com/wp-content/themes/parallax-pro/images/photo.PNG
amandathewebdev
MemberThanks Victor, I didn't know about that plugin. I set it up and it's just what I need! I can add my before footer content to the widget, and now I can add the actual footer content into the footer.
amandathewebdev
MemberThank you Christoph!
amandathewebdev
MemberHi Jackie,
No I didn't try that - I wound up messing with the template but I see that there are widgets set up specifically for homepage content. I'm using Advanced Custom Fields (plugin) though, and want my client to be able to easily edit homepage content, so I shouldn't go the widget route, right?
amandathewebdev
MemberThanks to braddalton for his guidance. What I wound up doing is NOT removing the slug from the URL, but instead rewriting it. For anyone in a similar jam, here is what I wound up doing, and here is a link to the Stack Overflow I posted and got help from.
//Rewrite cpt slug to get rid of 404 generated by the function below add_filter('generate_rewrite_rules', 'my_rewrite', 9); function my_rewrite($wp_rewrite) { $wp_rewrite->rules = array_merge(array( '^([^-]*)-county-([^/]*)/([^/]*)/?$' => 'index.php?post_type=county-job&county=$matches[1]-county-$matches[2]&county-job=$matches[3]' ), $wp_rewrite->rules); } //No longer use links with /county-job/ as prefix add_filter( 'post_link', 'my_post_link', 10, 3); add_filter( 'page_link', 'my_post_link', 10, 3); add_filter( 'post_type_link', 'my_post_link', 10, 3); add_filter( 'category_link', 'my_post_link', 11, 3); add_filter( 'tag_link', 'my_post_link', 10, 3); add_filter( 'author_link', 'my_post_link', 11, 3); add_filter( 'day_link', 'my_post_link', 11, 3); add_filter( 'month_link', 'my_post_link', 11, 3); add_filter( 'year_link', 'my_post_link', 11, 3); add_filter('post_link', 'my_post_link', 1, 3); function my_post_link($post_link, $id = 0) { $post = get_post($id); if(is_object($post) && $post->post_type == 'county-job') { return str_replace('county-job/', '', $post_link); } return $post_link; }
amandathewebdev
MemberOK - that hack to remove the slug is what I think caused all of my problems in the first place. I found a lot of stuff online about if you remove the slug, WP no longer recognizes the CPT as a CPT so you need to write a redirect rule. I have read from other sources though that you do not want to do this and it defeats the intended purpose of a CPT.
Do you know how I might solve my problem in some other way?
What I want to do is this. I want my URL to be
/county-name-state/post-title
. I want to group the posts by county. So I created a County post type. This holds all of the counties so that when someone goes to create a county post, they can select a county from the custom taxonomies. But by doing this, I wound up with a URL/cpt-slug/county-name-state/post-title
which is not good because Google will now think there is a parent page/cpt-slug/
which there is not. This will hurt SEO.The other reason I chose CPT (besides grouping) is that I want all posts to share a single template,
single-county.php
. So when I make a County post for Pennsylvania, New Jersey or Delaware, they all have the same custom fields, they all have the same template, and same URL structure:/county-name-state/post-title
So are Custom Post Types not the way to go for what I need? If so, why the slug in the URL? What is the proper way to do this?
Thank you again for all of your help!
amandathewebdev
MemberThanks for sticking with me on this - when I added your code I noticed a post from a plugin I deactivated was in there. So I deleted it and added a new one, but this gets a 404.
Is it possible a plugin or plugins I deleted are still effecting things?
I also read that even with your own code, you can not get rid of the CPT slug from your URL. Is that true?
amandathewebdev
MemberNew input, I changed some settings in the CPT UI (plugin) and the 404 is gone. But the custom CPT code post is still 404ing, even when the CPT UI plugin is disabled.
amandathewebdev
MemberYou might find this as crazy as I do - I deactivated all plugins. Selected all, applied bulk action deactivate. Named the custom CPT code to have the same names and slug as the CPT I made with the plugin CPT UI. Saved permalinks again (this is: http://siteurl.com/%category%/%postname%/) and still getting a 404.
This didn't start happening until I downloaded the "remove slug from custom post type" plugin so I really think it has something to do with that - even though I deleted it. But how would I know?
I found this: http://dreamdare.org/tips-tricks/how-to-fix-wordpress-custom-post-type-permalink-404-error/
And I added the
flush_rewrite_rules();
they recommended after the code you provided. But that didn't work.amandathewebdev
MemberHi braddalton - thanks for your response! I did try out the code you suggested and it worked to create a CPT for sure. But it's hard for me to tell if it's going to do what I need because the post I created is showing a 404 just like it is with the ones created by the plugin.
I did resave my permalinks. I also set them back to default, saved, set them back to custom, saved, a bunch of times while clearing my browser cache. I went into the post and saved, refreshed. I also reset my .htaccess file to the one I was using before the 404 errors started happening. I'm not sure what is causing this problem.
-
AuthorPosts