blatan
Forum Replies Created
-
Forum: Hacks
In reply to: additionals arguments in apply_filters()Thanks bcworkz, you can be right.
Regards,
BernardForum: Fixing WordPress
In reply to: Chrome crashes when I want to go from post editor do media libraryI’ve noticed the problem is with only one instance database.
On my localhost I have several sites.
I checked another website (with another DB) and it was ok.
WP crashes on the website which I’m using for testing my new theme. For testing I copied DB from another website.
So I checked the original website with original DB and it crashes as well.
I checked the website in the Internet (the website is running) and there is ok.It means the problem is with one DB on my localhost. If you have any ideas I’ll be grateful. If I find something out I’ll let you know.
Forum: Fixing WordPress
In reply to: Chrome crashes when I want to go from post editor do media libraryThanks for the tip.
I turned it off, but it was the same.
I restarted apache and mysql – the same.
I restarted Windows – the same as well.Any ideas?
Forum: Hacks
In reply to: function for attaching existing attachment to a postHi codegrunt,
you’re right.
wp_insert_attachmentsets all what I need, but you have to add as the first argument an array. It isn’t necessery in my case, because my attachment has been already loaded to the DB. All I have to do is setting post_porent. If you want to dettach, you have to set post_parent to 0 (zero).But as I wrote in the second post – I can set only one parent of the attachment since the type of post_parent field is BIGINT. This way I answered by myself for my question from the first post and I stopped searching a proper function, but it’s very simple, even if you are to set it with
$wpdbdirectly.My second question is if you know a good way to set many parents of one attachment. I think the best way would be setting custom_fields. You just has to use:
add_post_meta($post_id, $meta_key, $meta_value, $unique);where the last optional argument $unique with default
falseallows you to set many meta values for one meta key. For instance:attached_image => image1.jpg
attached_image => image2.jpgThen you can simply get it with:
get_post_custom_values($key, $post_id);IMHO it’s the simplest way to set many images to many posts.
I’d just ask you to confirm it or tell me some smarter way if you know any.
PS.
wp_insert_attachmentis good when you want to post ($_POST) your form.
I usemedia_sideload_image($file, $post_id, $desc);, where file is simply URL, because I load images from another server. It’s a very convient function.Forum: Hacks
In reply to: function for attaching existing attachment to a postI analyzed the DB and I noticed the attaching file is simply setting post_parent field in the row of the attachment.
I’ve read I can’t set 2 parents for the post. Bad news for me.
I wanted to attach one image to several posts. I think I can resolve it in other way. I can set custom field with the name of the file or simply with attachment_id.
What do you think about it? Does anybody know any smarter ways to do it?
Thank you for that.
For now I’ve got a better idea than hard code in your class.
I’ve used jquery after the div display the trail.<script language="JavaScript"> //alert($('html').attr('lang')); if($('html').attr('lang') == "en-US" ) $('#pageFooterLinks div.breadcrumbs a:contains("strona glowna")').text('home'); </script>where “strona glowna” is the Polish title of “home”
I hope it will help someone who has the same problem.
You’re right.
I removed the loop and I left foreach.
Yesterday I got the idea I had to reset query but I was too tired to do it.
It was my fault. Thank you for you time.I have another problem which I describe here. Would you mind if I asked you to look at it?
Thank you for everything.
In version 4.0.1 there is the same problem.
I forgot to add…
On parent page the trail is: home > parent page > the last child pageNow I realized I had updated the plugin. I’ll try checking the previous version asap and let you know
I use breadcrumb below the content.
In page.php I have:<div class="breadcrumbs"> <?php if(function_exists('bcn_display')) { bcn_display(); } ?> <span class='pageFooterLinkPointer'></span> </div> <?php endwhile; ?>I don’t have query_post() in page.php. The pages in breadcrumb trail is: home > parent page > current page
In the file with template for parent pages I have:
<?php if (have_posts()) : $posts = get_posts($args); foreach($posts as $post) : setup_postdata($post); the_content(); endforeach ;?> <div class="breadcrumbs"> <?php if(function_exists('bcn_display')) { bcn_display(); } ?> <span class='pageFooterLinkPointer'></span> </div> <?php else : ?> <!-- 404 --> <?php endif; ?>Of course I have other html tags above too but I removed them.
Forum: Hacks
In reply to: Uploading file from another serverThe solution is a function media_sideload_image. The topic can be closed.
I’ve just noticed it’s quite big problem.
When I change slug of media, for instance ‘hydra’ to ‘hydra-media’ my category of posts it ‘hydra-media’!I checked in DB. In ‘terms’ table there aren’t two ‘hydra’ ‘categories’. It means the plugin overwrote my categories.
I’m thinking about categories children. What could have been changed?
Have anyone an idea how to fix it?
When I change or delete post category or media category the second one is changed or deleted as well.I can’t filter “No categories” as well.