A few months ago you provided me with some code for functions.php to remove the slug in the url for portfolio items. After the latest update this stopped working even when I add the code again to the php file. Can you please give me an updated code?
I would like to reverse the hover order on thumbnails in my portfolio masonry. Now, it turns transparent white with black text on hover but I would like it to start from transparent and turn to colour + white text on hover. Can we make this happen?
1— Can you please add the following code in functions.php (end of file):
/**
* Remove the slug from published post permalinks.
*/
function laborator_remove_portfolio_prefix_from_link( $post_link, $post, $leavename ) {
if ( 'portfolio' != $post->post_type || 'publish' != $post->post_status ) {
return $post_link;
}
$post_link = str_replace( '/' . $post->post_type . '/', '/', $post_link );
return $post_link;
}
add_filter( 'post_type_link', 'laborator_remove_portfolio_prefix_from_link', 10, 3 );
/**
* Some hackery to have WordPress match postname to any of our public post types
*/
function laborator_get_portfolio_item_without_post_archive_prefix( $query ) {
// Only noop the main query
if ( ! $query->is_main_query() )
return;
// Only noop our very specific rewrite rule match
if ( 2 != count( $query->query ) || ! isset( $query->query['page'] ) ) {
return;
}
// 'name' will be set if post permalinks are just post_name, otherwise the page rule will match
if ( ! empty( $query->query['name'] ) ) {
$query->set( 'post_type', array( 'post', 'portfolio', 'page' ) );
}
}
add_action( 'pre_get_posts', 'laborator_get_portfolio_item_without_post_archive_prefix' );
2—To change white color there you must change the color of this CSS code:
Thanks for your reply. Unfortunately, the code makes my site refuse to load at all. Do you want to give it another try? I would appreciate it.
For my second request, I think you missed my question here ;). I want to reverse the hover order on masonry thumbs. I want to start from transparent white thumbs (without text) and go to clear (with text) on hover. The other way around for the transparency. Is there a way to do this?
Can you please share your WP and FTP credentials here, because I need to login to your site and test this issue. Your information is safe here (private) in this thread.
To include your credentials click Insert Credentials button in editor toolbar. (See how)
2— I know exactly what you are asking, i tried to achieve that, but from the code that is for the moment, we can't do this. We will try to do something about this on our future updates i think.
1. Since you are using "work/{item-slug}" prefix, then the code was not working, so I have modified it to work with new portfolio URL prefix, the problem is solved now.
2. I've added this to our todo list, and will implement when other promised features are implemented.
Ah, that makes sense. Thanks for solving this! It would be great if there's a way to implement this into the theme instead of having to change php files after each update. I'm sure most users would prefer this, but may not know about. Perhaps something to consider?
I look forward to seeing the reverse hover state in a coming update. :)
Hi team Laborator,
Hope you guys are well! Ihave two problem I hope you can help me with:
Thanks a lot! :)
/Jonas in Stockholm
Hi Jonas,
1— Can you please add the following code in functions.php (end of file):
2—To change white color there you must change the color of this CSS code:
that you have added earlier to your Custom CSS.
Then to make the text white please add the code below to Custom CSS:
Hi Ylli,
Thanks for your reply. Unfortunately, the code makes my site refuse to load at all. Do you want to give it another try? I would appreciate it.
For my second request, I think you missed my question here ;). I want to reverse the hover order on masonry thumbs. I want to start from transparent white thumbs (without text) and go to clear (with text) on hover. The other way around for the transparency. Is there a way to do this?
Thanks again for the support!
/Jonas
Hi Jonas,
1— Hmm i tried this and it worked on my end.
Can you please share your WP and FTP credentials here, because I need to login to your site and test this issue. Your information is safe here (private) in this thread.
To include your credentials click Insert Credentials button in editor toolbar. (See how)
2— I know exactly what you are asking, i tried to achieve that, but from the code that is for the moment, we can't do this. We will try to do something about this on our future updates i think.
Hi Jonas,
1. Since you are using "work/{item-slug}" prefix, then the code was not working, so I have modified it to work with new portfolio URL prefix, the problem is solved now.
2. I've added this to our todo list, and will implement when other promised features are implemented.
Will set this ticket as solved from here.
Hey Arlind,
Ah, that makes sense. Thanks for solving this! It would be great if there's a way to implement this into the theme instead of having to change php files after each update. I'm sure most users would prefer this, but may not know about. Perhaps something to consider?
I look forward to seeing the reverse hover state in a coming update. :)
Thanks again,
Jonas
Hi Jonas,
Yes, this will be implemented in the next update of Kalium as an option in Portfolio settings page.
Have a great day.