herculesnetwork
Forum Replies Created
-
Hi BCWorkz. Thank you so much… I’m taking a long time to answer, because I’m studying for this plugin, I did a chronological summary of his tips, which are very descriptive, and I’m studying to understand them at the level of writing, to start writing the plugin, I confess that I do not have the ability to start writing, I’m studying more PHP, for as long as I have, to understand. Now I am confused, but for simple deficiencies in basic knowledge.
I’m studying and I’ll call you as soon as I can write something acceptable.
To 3 days ago, I came to a solution, and with some simple changes, I got my solution. To have the albatross alt in all my images automatically, I found a code and I was able to adapt to my needs, thanks to the base I already have, and a lot of things I learned from you, but I do not understand the points about the auto Rum to script, and I really want to be able to figure out how to work this process, I’m studying and I’m coming back here as soon as I’m able to get something worthy of at least its correction.I’m going to study to write a file for each key word, and after the cron job, to have a different script run at different times, it’s something I think is simpler, first I have to think about simpler things, make things happen , When able to make improvements. Thanks all.
- This reply was modified 7 years, 6 months ago by herculesnetwork.
Hey BCWorkz.. ??
I’m worried about all this complexity of querying data and checking if they have already been fired or not, and the function does not fire at a certain time because it’s still a little behind schedule, those your explanations about cron, it’s like I’ve read in a Blog, about how these possibilities of not firing execution, make many programmers use cronjob, would not it be simpler code to not use wp cron to schedule these shots? And I use the server schedules via cronjob to set the time of those firing !?
Cheers ??
Hey friend, I received your short / advised feedback by email, sorry I was not clear, I should have said it was just a mere comment off topic, about a click event, etc … I really was not asking His help by email, was an offtopic comment that does not even need answers, but I was not clear in my bad writing, I could not ask any real email questions, as if I did not actually, and one Since that was not my true intention, nor did I need any feedback on those quests, but I did not write well, sorry ??
Talking a bit about the alt creators plugin in all the image files in the library, it works fine, but I’m afraid it will stop working in the future, and it will not take long for that to happen, since cron cron no longer works .. I’m going to open a topic in the future to see if we update the alt ally directly in the database, I imagine that uses an update $wpdb. But this will ask in another topic(because google loves the alt attrib in pictures) ??
And thanks for the feedback, I am really now seeing that there is not much relation, the click event with jquery in plugin that require clicks with the auto run by scheduling, because the click event can be done inside the file itself, so there is not much Relationship with our “auto run a plugin”
So I’ve been wondering … where to start our “auto run a script”?
<? function automatic_plugin_trigger(){ //And now what I do of this code life ... I'm lost, where to start :-( if( wp_next_scheduled( 'automatic_plugin_trigger') ){ wp_clear_scheduled_hook( 'automatic_plugin_trigger' ); } } ?>
I understand a little bit about your guidelines in the above responses, but I do not understand what to do within our function, and what do you do about changes to the orginal files of the target plugin?
Cheerss ??
- This reply was modified 7 years, 7 months ago by herculesnetwork.
- This reply was modified 7 years, 7 months ago by herculesnetwork.
- This reply was modified 7 years, 7 months ago by herculesnetwork.
- This reply was modified 7 years, 7 months ago by herculesnetwork.
- This reply was modified 7 years, 7 months ago by herculesnetwork.
Hi @bcworkz ??
Thank you very much againnn, for the class on data analysis emitted in events triggered by a script :-), I did not know this feature in browsers!!
Let’s go to work about our script “auto run a plugin” ??
I’ve been thinking, this script is for more stuff than I was imagining! It will serve many things, imagination is the limit.
I’ve been wondering how this script can be useful for many things ..
??If I learn how to automate a process in a plugin, I will be able to automate other processes of that level. If ???I’m really impolite with this, imagining the possibilities
You think, many things you can automate too ?? to avoid forgetfulness and increase productivity ??
- This reply was modified 7 years, 7 months ago by herculesnetwork.
- This reply was modified 7 years, 7 months ago by herculesnetwork.
- This reply was modified 7 years, 7 months ago by herculesnetwork.
- This reply was modified 7 years, 7 months ago by herculesnetwork.
Yes. Truth .. you’re absolutely right … And I really could not feel upset ?? I’m really distracted really, I unlock a lot of the time, I’m typing in a very continuous way! And forget to do the basics in the texts. Yes the text with paragraphs is the best way ever! And sometimes I get the text very often / continuous! But the editing time has expired! But the correct one was not having to edit, it would be better already and good way. I’ll improve this :-$
?? I’m going to call you on the other topic, I’m researching about keypress stock uploads, and I got to xdotool … I’m seeing alternative, I want the simplest possible method, I do not need user interface to do this cron, no fields and Buttons, I just want the same script … I have no preferences if it will be with javascript, xdottool or php, I just want to learn how to do this automation in some way.. I’ll call you there and Thanks againnnnn ?? .
- This reply was modified 7 years, 7 months ago by herculesnetwork.
- This reply was modified 7 years, 7 months ago by herculesnetwork.
- This reply was modified 7 years, 7 months ago by herculesnetwork.
Hahaha good that my way of being comic / crazy amuses you, so I have a way to contribute minimally about something for you ??
???I discovered that several posts were missing thumbs because of a bug in an update on one of the import plugins that I use .. so I thought, I’ll have to find a solution, I’m flooding the bcworkz with questions and our lesson about “auto Run a plugin” will not be paused again, noooooo… so I thought, so I do not need to use the your fantastic “update page’s bcwz” of the library via $wpdb; That you has created :-), (I would have to ask you how to edit it for to scan the posts without a featured image from my database and to delete) I’ll have to find something, so I found a plugin today, calling “Post List Featured Image” her is doing Many people very happy) because it adds a feature that misses the wordpress coming by default in it(or in an official plugin), which is a filter on the admin / posts list that we can filter shows all the posts with featured ima and without featured ima, or without featured ima.. this helps a lot in many cases, so [SOLVED], we mark in library media page,for that image used as featured image to be linked in another level to the post, level that to the we delete the post, and image go It goes together, and does not let the system forget any unused image on the system, uses the “sky remove” plugin, every time we delete a post, it takes along the used image in featured Image, the feature that would be good if wordpress had option(in an official plugin) ?? ..(I understand that a cms with everything ready is not ideal, because then it would be heavy, having the resources separately in plugins, it can get leaner and each person will put just the weight that it needs, but I’m sad with incredible plugins stopping work Because the developers abandon the times !, but I think there must be a balance between CMS not coming with these things, but not depending on third parties, wordpress team have more plugins like jetpack and others, deleting images along with the post, and List posts with filter posts without featured image has made me very happy, and the 10 users who voted also srsrsr, it is very useful indeed! , Not by the number of people, but the level of appreciation of the people, you realize that it was very essential, many should miss and do not know to find this plugin ), has plugin that do amazing things, but few people use and do not thank giving a good rating, I highly praise any plugin that I use and serves me. As I am still very poor and I can not donate, at least help with the minimum that is of notoriety to the developers who contribute so much to the lovely wordpress universe ??Everything was solved .. and in two days I call you in our “auto run a plugin” ??
See you soon friend and thaaaannkksss so much ??
- This reply was modified 7 years, 7 months ago by herculesnetwork.
- This reply was modified 7 years, 7 months ago by herculesnetwork.
I tried a lot until the exhaustion did this from the outside, with our own plugin, but since I did not want to accept the title, nor convert it and everything else .. I went inside the plugin import in that case too, and I did : I just commented on that area where I said it looked like a big mess,
And I applied info in the variable that stores the image in the plugin, and concatenate the variable that stores the title + variable that stores the opted by the info extension, then, the sum of these variables and I applied in the basename of the plugin. If the data is already available within the plugin, I should not have endured so much trying to find them after posting in the publication; In short, I did it in two different ways, like those two code above that I said that work only with strings and not with post_title … so … doing those same things inside the plugin, it worked. I spent about 30 hours on this thing! Aafff .. I’m too tired now ?? .. but I did, thanks to you that it helps me a lot. Without your help I would not be able to. ??
I’m going to eat something and get some sleep and let’s work on that automatic plugin firing with pre-filled fields ?? ?? See you late my friend ??
THANKKKSSS AAAALOTT. Thank you so much againI has founded his code almost complete here on codex!!
“his code”!Many thanks for this too ?? :
while ( file_exists( $dir . "/$filename" ) ) { if ( '' == "$number$ext" ) { $filename = "$filename-" . ++$number; } else { $filename = str_replace( array( "-$number$ext", "$number$ext" ), "-" . ++$number . $ext, $filename ); } }
My brain is really frying with this:
This code works perfectly to modify the name of the file defined as featured image:
add_action('add_attachment', 'rename_attacment'); function rename_attacment($post_ID){ $post = get_post($post_ID); $file = get_attached_file($post_ID); $path = pathinfo($file); //dirname = File Path //basename = Filename.Extension //extension = Extension //filename = Filename //$friendly_name = get_the_title(); //$friendly_name = $post->post_title; $friendly_name = "NEW NAME TO IMAGES UPLOADED"; $newfilename = $friendly_name; $newfile = $path['dirname']."/".$newfilename.".".$path['extension']; rename($file, $newfile); update_attached_file( $post_ID, $newfile ); }
$file = get_attached_file($post_ID);
Is it being sufficient to get the object / file and restarts it, I do not know if we should worry about another way to pull the file, if that code already does the job, the file is always renamed successfully at the time of creating the post , Because it modifies the filename at the time that the image uploaded to my wordpress site, it arrives at the server, always work fine this code, the question here is to have the value of post_title to apply, or value of the slug, The case, both are good, because it always seems like it’s still done !! But I do not understand why, because it is not empty !!($post_ID),
was enough to open the image, and I modified it successfully, I do not understand why$post = get_post ($ post_ID);
Not for pulling post_title! I can not think that the title of the post is still empty when this action is triggered, because simply this code is working well to pull the image, which by the way, can only be work with the above code, if the post already exists, because It came out of the variable import plugin, if it is there inside the get_attached_file so I modify it, the title is certainly ready before it !! The image is the last thing the plugin import works, it first takes care of the other elements of the post, if that code works well in the image, why can not I get the value of the title? He already is in the$post_title
of wordpress!
The image is always renamed with just:.jpg
(without words, missing words!) using the value $post-> post_title; !! As if it had nothing inside the variable, but it has yes !! If you have in get_attached_file it’s also to have inpost_title
!
Then in the plugin, the object that holds the image of the thumb is $image which is then copied to:$thumbid
; Then beforeset_post_thumbnail ($post_id, $thumbid);
I do inside the import plugin, I did as the Castilian orders(or not ?? ):// hercules begin // $file = $thumbid; $path = pathinfo($thumbid); //dirname = File Path //basename = Filename.Extension //extension = Extension //filename = Filename //$friendly_name = $post_title; // $friendly_name = "NEW NAME TO IMAGES UPLOADED"; $friendly_name = $title_Item_x; //var used from this plugin $newfilename = $friendly_name; //$newfile = $path['dirname']."/".$newfilename.".".$path['extension']; $newfile = $newfilename.".".$path['extension']; // rename($thumbid, $title); rename($thumbid, $newfile); // hercules end set_post_thumbnail( $post_id, $thumbid );
My brain will melt, because when I insist on something, I do not stop! ??
- This reply was modified 7 years, 7 months ago by herculesnetwork.
- This reply was modified 7 years, 7 months ago by herculesnetwork.
And in place in
$post;
Would be$wpdb;
And to pull an inner element of the post edit? Would be a field like:$slug = get_post_field ('post_name', get_post ());
?Ohh yes, I just noticed one thing, when you talked about taking care not to modify files with old dates that may contain associations that can be broken with the name name … I remembered to say that the important thing is all future posts come with new Image file names, the plugin that I miss very much, it rally rename all the image files already existent in the server according to the name of the posts to which the image was associated, but one thing I forgot to say, is that with The posts with bad names already exist, I do not need to worry, because the plugin that renames everything, stopped working shortly, I have to worry about future posts, and ideally, the images already enter the system With the friendly “correct” name, as I’m even trying to do it up, working directly on the $title and $image plugin objects, if you have a plugin like this that I wrote above, that only works with strings, because I’m using $post pulling frontend data! Idea and what simplifies more things, we will think to rename the image at the time of the posting, we can really forget the issue of renaming existing files with bad names, because simply, there are almost no bad name files, but many will come bad if I do not modify that crazy plugin that pulls images with crazy names. I have a second import plugin that already fixes this(And I do not understand(I’m beginner srs) the code of this import plugin that already arranges name of the images). This is the dirty plugin of “my repository”. Soon, if the plugin that made up the mess stopped working, then I thought I’d have something that would never let things mess up from now on.
this is the Messy plugin(The same as we used as an example for create auto import). Of course, this plugin is not available in the wordpress repository, it sells out, I do not even know if it would be in the curatorship, he’s so Messy, that I got his look, putting some more beautiful buttons, and Also correcting terms of writing.Messy Plugin: Messy Plugin
Thank You So Much.
- This reply was modified 7 years, 7 months ago by herculesnetwork.
That morning before I fainted from sleep, I was trying to get some things you’re teaching, but I still did almost everything wrong:
add_action('add_attachment', 'rename_attacment', 999, 3); function rename_attacment($post_ID){ $post = get_post($post_ID); $file = get_attached_file($post_ID); $path = pathinfo($file); //dirname = File Path //basename = Filename.Extension //extension = Extension //filename = Filename //$post = get_post( $post_ID ); //$newfilename = $post->post_title; $newfilename = "today will to be amazing"; $newfile = $path['dirname']."/".$newfilename.".".$path['extension']; rename($file, $newfile); update_attached_file( $post_ID, $newfile ); }
That way up, it always works, but only with string !! The same old case, but my mistake was trusting $ post again, I still had not read your help from that topic. So, the latest method is the least wrong for dispensing sanitize, I just have to change the use of $ post.
And also I have been trying to do directly in the plugin, it saves the obgect in $ image:
// hercules begin; // $post = get_post($post_ID); // $file = get_attached_file($post_ID); $file = $image; $path = pathinfo($file); //dirname = File Path //basename = Filename.Extension //extension = Extension //filename = Filename //$post = get_post( $post_ID ); //$newfilename = $post->post_title $newfilename = "to day will to be a great day"; $newfile = $path['dirname']."/".$newfilename.".".$path['extension']; rename($file, $newfile); rename($image, $file); // hercules and;
# but too not working! More than 80% of the things I have trying to do, I get to do it directly by modifying these plugins, which are the basis of my work, when I can do an external code, my plugins, which I have several, I’m even happier. But when it works directly in the original plugin files, I use this method. First I try to make it out, when I can not, I go to the guts of the plugins. This time it’s not working, I’ll work hard on your tips now.
- This reply was modified 7 years, 7 months ago by herculesnetwork.
- This reply was modified 7 years, 7 months ago by herculesnetwork.
- This reply was modified 7 years, 7 months ago by herculesnetwork.
note: My lack of sleep made me try a str_replace like a creazy! But too the code bellow not is my.
Why does not this rename my images / uploads with the name of the post, but only with a number + dimensions? Uploads / 1-320×280.jpg? WordPress 4.7.4
function new_filename($filename, $filename_raw) { global $post; $info = pathinfo($filename); $ext = empty($info['extension']) ? '' : '.' . $info['extension']; $new = $post->post_title . $ext; // the if is to make sure the script goes into an indefinate loop if( $new != $filename_raw ) { $new = sanitize_file_name( $new ); } return $new; } add_filter('sanitize_file_name', 'new_filename', 10, 2);
thanks all.
- This reply was modified 7 years, 7 months ago by herculesnetwork.
Thankssss BCWorkZ Again,
I received your response as soon as you wrote it, I danced here with joy just because you did this complete analysis of the situation, I was thinking if I had shown well about the plugin, I see it was a good presentation of it, ??
offtopic:
??As soon as I read your answer, I came across a problem that started when I updated my wordpress for last summer. A plugin that saved me crashed! Was the bulk rename plugin (Rename Featured Image by hirishv90) it saved me, because just this plugin we are dealing with in this topic as an automotive example, it makes postings and creates featured images where my posts receive images with horrible names iudhog64544dfkjfdfdf654646884afakfnf.jpg and are Applied as featured images, which bulk rename plugin I used which is a third part plugin, here from the wordoress repository. He undid this dirt in the names of the images, he put the same post_title, very good for SEO after applying the rules, but it does not work anymore, he does not even appear the action menu anymore! So I stayed from Saturday straight, without stopping in this I’m exhausted! For this I did not expect! I created a topic in the Stack about this, because here we are already dealing with that which is a doubt that I have for years: how to automatic actions in plugins!, and we are doing well talking about it!I think I’m going to open a topic here too, about this, I’d like to do it later, but I’m having a lot of images with unfriendly names for google!
begin;
Yes, even if it is not necessary for this case to learn about analyzing the data during a browser run, I am very interested, yes, you have no idea of ??the size of my curiosity ?? I want to learn this ?? my favorite browser is firefox ?? but sometimes I use google chrome and chromium
?I’ve been thinking, let’s make a single file that calls the parts of the plugin that I want to do the action … so I imagined it like this:
$kwords_to_00_hour = 'sports'; $kwords_to_01_hour = 'funny'; $kwords_to_02_hour = 'cars'; $kwords_to_03_hour = 'foods'; $kwords_to_04_hour = 'dance'; ... $kwords_to_24_hour = 'compilations';
A varaivel for each search gave day done every 60min
Then would there be a timer function that would make a carousel with these variables above? And then placing one of them inside a variable that would come in the place of:
<input type=”text” name=”k” value=”$var_with_result_carousel” placeholder=”asian fun” id=”keyword” maxlength=”2048″ size=”30″ />
Thaaankssss.
- This reply was modified 7 years, 7 months ago by bcworkz. Reason: altered nsfw reference
I found that it only breaks the action my skin html videosjs player, its I use a specific theme, its plugin fulfills what it promises in some way, but with a theme of mine, it is incompatible, a premium theme pro, you will have an appraisal Of 4 stars, and I can improve it to 5, when the plugin has HINT clearer (on hover), better explaining the items in settings toggle, and has a undo button all, not just a clean log and task! what is it? In short, it does not have a friendly code with my best theme premium, and improve(with hint on hove) the settings area better. Yes. I will send a email with info url site/plugin/theme. Thanks.
- This reply was modified 7 years, 7 months ago by herculesnetwork.