Posts by Ricardo Moraleida • 4,005 points
175 posts
-
0
votes1
answer655
viewsA: How to only get a cell from a CSV file with PHP?
Deconstruct the CSV by taking the column index from the first row and searching the value for the specified row, for example, for the table: 1 | a | b | c | 2 | AA | BB | CC | 3 | XX | YY | ZZ | We…
-
1
votes1
answer532
viewsA: Fatal error: public_html/wp-includes/option.php on line 126
untrailingslashit is a standard Wordpress function so it means some file is missing or corrupted. One thing that may have happened is that some files failed to get to the new server. This is very…
wordpressanswered Ricardo Moraleida 4,005 -
1
votes1
answer532
viewsA: Definition in phpstorm IDE
What generates this is the Inspection calling for Typo, because its variables are in English. You can disable or change its settings within the Phpstorm options, at Editor > Inspections >…
-
1
votes1
answer371
viewsA: How do PULL keeping HEAD changes?
I want an automated way, since in that case all conflicts will be maintained by the local version and discarded the origin Use $ git pull -s ours This will resolve conflicts by always prioritizing…
gitanswered Ricardo Moraleida 4,005 -
2
votes1
answer399
viewsA: Docker is not running
You need to add your user to the group docker: $ sudo usermod -aG docker $USER then log out/log in again and you must have access.
-
1
votes1
answer1346
viewsA: Integrate wordpress site with external system
You can do this without plugins or external tools. Create a plugin and create a Post Type within it to save the information of each import. To receive the information: This depends on how and where…
wordpressanswered Ricardo Moraleida 4,005 -
0
votes1
answer92
viewsA: Could not read from remote Repository
In case you do not use an accessible URL you need to use the SSH syntax to access the repository: $ git clone user@vmserver:/vmserver/projetos/cliente1 In that case user@vmserver is what you would…
-
1
votes1
answer396
viewsA: How to return to the "normal state" of Html after a refresh-free Javascript query?
Just you save the data from div.result before the first interaction. See the variable htmlOrig. When you have nothing else to show, go back to the previous place and your HTML goes back to its…
-
1
votes1
answer621
viewsA: query_posts , take the category and subcategory
You haven’t said what error you’re getting, but I assume you’re not getting results, right? Your current code is specifying taxonomy familia_peixe_familia and the term familia_ordem_peixe but does…
-
0
votes2
answers105
viewsA: Search system with Inner Join
Just specify in INNER JOIN what the relation between the tables. In case you want only the data of the tables where sessions.movie_name = movie.movie_id. SELECT movie_name FROM movie INNER JOIN…
phpanswered Ricardo Moraleida 4,005 -
0
votes1
answer53
viewsA: PHP error when host changes
Your environments are with different configurations of error reporting. If you look at the php.ini or phpinfo() of each, you will see two settings: error_reporting = E_ALL # ou outro valor…
-
3
votes1
answer1685
viewsA: Tips on how to make a search field with Wordpress
Standard Wordpress search always starts with a request GET containing the key s: www.example.com/?s=gatinhos does a search for "kittens" in the database. The default search only searches the data in…
-
1
votes2
answers214
viewsA: How to store record in new column within wp_users table? (Wordpress)
Do not create new columns in the original Wordpress tables, this is never a good idea. If you need to store the CNPJ use add_user_meta or update_user_meta. Data will be saved in the table…
-
0
votes1
answer605
viewsA: Integrate Wordpress with Oracle
Use the hook save_post for this. It runs immediately after a post has been recorded in the bank, and loads the information that has been sent. Then you connect to Oracle using PDO and follows as if…
-
3
votes1
answer141
viewsA: How to remove improper commits from a remote branch?
It seems to me a case where revert and cherry-pick can be used well, without branches being so different from each other. Take the history of the commit hashes made in the wrong branch and make a…
-
1
votes1
answer1064
viewsA: Consuming REST in Wordpress
If you have "implemented a Rest API" I think you just need to know the native WP methods for making requests: wp_remote_get() wp_remote_post() Under the hood they do more or less the same thing, use…
-
1
votes1
answer55
viewsA: "Element dl is Missing a required instance of Child element dd." Wordpress
Gallery code can be created in two ways, HTML5 or not. When the theme has HTML5 support the tags created are <figure>, <div> and <figcaption> instead of <dl>, <dt> and…
-
3
votes1
answer61
viewsA: Wordpress, Multisite second site post also appear on main site
You can do it using switch_to_blog( $id ) and restore_current_blog(). Within the theme of site1 you use the functions to search the content of site2. switch_to_blog() causes the database queries to…
-
3
votes3
answers447
viewsA: How to disable the merge message in git pull?
The command you want is $ git pull --no-edit Personally I prefer to use --no-edit when I do git merge and not in git pull because it is important for me to know when the HEAD from my local…
gitanswered Ricardo Moraleida 4,005 -
1
votes1
answer812
viewsA: Problems with Phpexcel columns
If I understand correctly, the problem is that you are not re-setting the value $col with each new line, so it keeps increasing indefinitely. Setar $col = 0 each new data line must solve:…
-
0
votes1
answer70
viewsA: Wordpress login with Webservice (AD)
You don’t need a página for this, you can just run the code in a hook early in startup, such as after_setup_theme, for example: // no arquivo functions.php add_action( 'after_setup_theme',…
-
1
votes1
answer70
viewsA: Return Path in wordpress
If wordpress update I have to make this addition of codes again in function? If Wordpress updates your edits will be lost, it is not a good practice to change the files of the core (nothing out of…
-
1
votes1
answer368
viewsA: List in sidebar Wordpress Taxonomy list
Use the function get_term_by() to retrieve Ford’s ID and wp_list_categories() to list child terms. If taxonomy is not category change in the example by the appropriate name: <ul> <?php…
wordpressanswered Ricardo Moraleida 4,005 -
2
votes1
answer26
viewsA: add_term_meta does not execute
wp_insert_term() returns a array containing term_id and term_taxonomy_id, when executed correctly, then you must pass the term_id to the functions add_term_meta and get_term_by: add_term_meta(…
wordpressanswered Ricardo Moraleida 4,005 -
2
votes1
answer99
viewsA: Show only 1 category on page
No need to use pages or query_posts() for this*. Use the Hierarchy of Templates wordpress. You must have a generic list file like archive.php, or even the index.php. Create a copy of it and rename…
-
0
votes2
answers37
viewsA: How to get several Custom Fields?
You can search directly in the database: global $wpdb; $resultado = $wpdb->get_results( "SELECT id,meta_value from {$wpdb->postmeta} WHERE meta_key = 'key';" );…
wordpressanswered Ricardo Moraleida 4,005 -
3
votes1
answer282
viewsA: How to remove the first value within an array?
You must use array_shift(), but be careful not to overwrite the array, because it returns the removed element, not the resulting array. That is to say: $arraycompleto = [1,2,3]; // Edit: se você…
-
1
votes1
answer106
viewsA: Link a JSON parameter to a product in Woocommerce
If I understand correctly, you need to access the properties of this JSON, right? Use json_decode() to turn into an object: $json = '{ "programa": "multiplus", ... }'; $objeto = json_decode( $json…
-
2
votes3
answers67
viewsA: How Wordpress updates are made
The Wordpress upgrade system works locally using the same mechanism used to make scheduling posts and other tasks on the site, called wp-cron. Cron is the name of the task scheduler embedded in Unix…
wordpressanswered Ricardo Moraleida 4,005 -
4
votes3
answers36730
viewsA: Error pushing origin master on github
You used the SSH URL ([email protected]...) to add the remote, so it looks for your key. The HTTPS URL has this format: https://github.com/andredsn/ArquiteturaSoftware.git then do: $ git remote add…
-
1
votes2
answers79
viewsA: Jquery does not find form
Try to use .on('Ubmit') instead of .Submit() $(document).on( 'submit', '#mapping_marc', function (event) { /* etc */ }); That way, even if the form enters later on the page the event will work…
-
1
votes1
answer2471
viewsA: Whatsapp Image, Wordpress
Whatsapp uses the same tags (og:tags, Open Graph) from Facebook to render the content, with some extra restrictions that seem not to be very well documented (it seems that the image can only be at…
wordpressanswered Ricardo Moraleida 4,005 -
0
votes1
answer123
viewsA: Modal plugins are not working on Wordpress
The most common cause of errors of this type is the use of themes that do not implement functions wp_head() within the tag <header> or wp_footer() at the end of the document. Make sure the…
-
1
votes1
answer176
viewsA: Wordpress with php 7+
Wordpress supports the PHP7 since 2015 and lists PHP7 as recommended version since the release of version 4.7. HTTP 500 is a fairly generic error, and has no direct relation to the PHP version. It…
-
1
votes1
answer126
viewsA: Enable function when publishing wordpress scheduled post
There are some alternatives to this, which usually involve intercepting the change of status of the post and running its code. You can choose which of these actions fit best with what you want to…
wordpressanswered Ricardo Moraleida 4,005 -
2
votes1
answer152
viewsA: How do IDE communicate with Xdebug inside a container (Docker)?
Researching a little more I discovered that the instruction xdebug.remote_host actually arrow a header X-HTTP-FORWARD-FOR, which is all it takes to tell Xdebug which IP to connect to. With a few…
-
1
votes1
answer152
viewsQ: How do IDE communicate with Xdebug inside a container (Docker)?
I have a network of containers created with docker-compose. The Xdebug settings are passed in part by the file .yml and in part by an archive .ini consumed by PHP. I know that Xdebug is installed…
-
0
votes1
answer195
viewsA: Problems with GIT
If the files were in "modified" status, they already existed on index Git, which is good news. You can recover all revisions of files that were saved but abandoned with the command $ git fsck…
gitanswered Ricardo Moraleida 4,005 -
2
votes1
answer595
viewsA: How to use $wpdb variable in wordpress
$wpdb::get_results() returns a list of objects by default, where each property is a column. The table wp_posts doesn’t have a column coluna_teste, therefore the mistake. The code below is correct…
-
0
votes1
answer66
viewsA: Wordpress plugin does not work called external FORM
Your error is in the form action: <form action="http://www.meusite.com/staging/wp-content/plugins/Integrador/integrador.php" > This path is recognized by the Wordpress server as a right access…
-
0
votes1
answer412
viewsA: The link option has disappeared from the wordpress menu edit panel
Search the upper right side for a call tab "Screen Options" or "Screen Options", click on that tab and select the option "Custom Links" or "Custom Links"…
wordpressanswered Ricardo Moraleida 4,005 -
0
votes1
answer184
viewsA: Random image gallery when opening the page (wp)
You can specify this in the shortcode itself: [gallery {outros argumentos} orderby="rand"]
wordpressanswered Ricardo Moraleida 4,005 -
0
votes1
answer43
viewsA: Translating wordpress plugin
This plugin works by rewriting the files .po and .mo which contains the translations. Many servers do not allow writing files by CMS for security risks. You can change these files directly using an…
-
1
votes1
answer310
viewsA: How to convert time in string to time from Ionic to PHP with Mysql?
You are using the wrong function: $prazo_entrega_min = time("hh:mm", strtotime($_GET['prazo_entrega_min'])); time() does not accept arguments, always brings the local UTC time. The syntax you used…
-
0
votes1
answer119
viewsA: Search using query_args() in wordpress
This query is rewriting the main query and can’t work like this. I’ll show you another way: <?php // functions.php add_filter( 'posts_where', 'busca_meta' ); function busca_meta( $where ) {…
wordpressanswered Ricardo Moraleida 4,005 -
0
votes1
answer28
viewsA: How to delete the original image after Crop?
One possible way is to use the action wp_ajax_crop_image_pre_save to replace the original image with the cropped image, something like this: add_action( 'wp_ajax_crop_image_pre_save',…
wordpressanswered Ricardo Moraleida 4,005 -
5
votes4
answers388
viewsA: Regex to capture infinite groups in a URL by separating them by the bar
It doesn’t make much sense to use regex for that, but it’s possible: Regex $url = 'http://example.com/Controller/Action/Param1/Param2/Param3/...'; preg_match_all( '|/([^\/]+)|', $url, $matches );…
-
1
votes1
answer43
viewsA: Implement 2 search criteria in the query (Wodpress/Mysql)
It seems to me that you are searching for conflicting fields in the table post_meta. In this table a record cannot have two meta_keys at the same time, so you need an expression OR to fetch both…
-
0
votes2
answers340
viewsA: Cache on Web Systems
A simple approach is to convert js and css according to the deploy version. Ex.: <?php define( 'VERSAO', '1.0.0' ); echo '<script src="https://example.com/arquivo.js?ver='.VERSAO.'" />';…
-
2
votes3
answers1136
viewsA: load content after an element
You can use $.get() to fetch the content and insertAfter() to position it, instead of load() and after(); function getTemplate(string){ var html = $.get( string ); $( html ).insertAfter('#here'); }…