Posts by Ricardo Moraleida • 4,005 points
175 posts
-
3
votes2
answers207
viewsA: Print full day of the week adding one day
The function date receives a Unix Timestamp, not a formatted date. // Tranformar YYYY-DD-MM em YYYY-MM-DD $data_formatada = explode('-', $item->data_inicio); $data_formatada = join( '-',…
-
1
votes1
answer72
viewsA: URL being incorrectly generated
Your site does not have the meta tag indicating the charset. Try to include this: <meta charset="utf-8"> within the tag <head> and see if it solves.…
-
1
votes1
answer476
viewsA: How to return a Category ID in Wordpress?
You can use get_term_by() with the data you have of the category. Ex.: // Retorna o objeto da categoria Animais Fofinhos $categoria = get_term_by( 'slug', 'animais-fofinhos', 'cattitulo' ); The…
-
1
votes1
answer89
viewsA: Import Wordpress bank
It’s possible, but not directly. You will need to write one or more scripts that convert the old database information to the new database format. A tool that helps a lot in this process is WP-CLI,…
wordpressanswered Ricardo Moraleida 4,005 -
0
votes1
answer30
viewsA: Custom page for each term
You are rewriting the query, so you may be having problems. Try it this way: Filing cabinet taxonomy-stafftax-professor.php <?php get_header(); get_template_part( 'wp-files/partials/banner' );…
-
1
votes1
answer591
viewsA: Page attribute, template, in a wordpress "project"
The "Page Attributes" box only exists for hierarchical Post Types, and your Projects should not be. In this case you can rename the PHP file and change the Templates Hierarchy in your favor.…
-
0
votes2
answers35
viewsA: Display post after the last 6
If you don’t need to worry about paging, offset resolves: $query2 = new WP_Query( "showposts=6&offset=6" ); while ( $query2->have_posts()) : $query1->the_post(); offset=6 makes the query…
-
0
votes1
answer142
viewsA: Wordpress - Edit Box Remover
If you are modifying native post types (post or page), you can do so in your file functions.php add_action( 'init', 'retira_editor' ); function retira_editor() { remove_post_type_support( 'post',…
wordpressanswered Ricardo Moraleida 4,005 -
0
votes1
answer22
viewsA: Page call using Class in Wordpress
Whenever you are referencing a method within a class you just pass the callback as array where the first element is the object itself: class Birthday_celebrate { public function…
-
3
votes1
answer958
viewsA: Git - How to use branches correctly
I go back to my master and work on it for a while Perhaps here lies the key to your difficulty. The most common Git usage patterns in general do not encourage you to work directly in your main…
-
2
votes1
answer993
viewsA: How to work with routes in wordpress
Are you looking for Rewrite API. It is used to customize Urls so that you can search for values within your query in any way you need. Example of Codex: <?php function custom_rewrite_rule() { /**…
-
0
votes1
answer363
viewsA: Open POST in php file
You can use the include method require('../../wp-blog-header.php'); to upload any content. What changes is how you call the content within your external file. By default when you include…
-
2
votes1
answer518
viewsA: $_SERVER['REQUEST_METHOD'] == "POST" Does not work PHP wordpress
Your form doesn’t have one input or button to work. Change <a type="submit" name="sub" style="width:120px" href="">enviar</a> for <input type="submit" value="enviar" /> And he will…
-
3
votes1
answer2887
viewsA: Include file in Wordpress
You need to include the full path, even if the file is within the theme. ex.: // /path/do/wordpress/wp-content/theme/nome-do-tema/config.php include get_template_directory().'/config.php'; //…
-
1
votes1
answer183
viewsA: get_role('Administrator') returning null
If the site has active users as administrators but the scroll has been edited in the database or removed, something like this may solve or at least help to understand the problem. In the…
wordpressanswered Ricardo Moraleida 4,005 -
2
votes1
answer454
viewsA: How to format Json code in HTML?
Assuming you are receiving the data in front-end via javascript you can enter so: var jsonString = '<h2 style="text-align: center;">Estréia do Blog</h2> <p style="text-align:…
-
1
votes1
answer278
viewsA: Report in mPDF only return a single record when receiving data via POST
Your inputs have names repeated in each row <input type="hidden" name="OSid" value="<?=$OSid?>" /> In this case when you send the POST the browser will send only the last read value, the…
-
1
votes1
answer314
viewsA: Error in SOAP Request
Assuming your code there is exactly as executed, you are passing the wrong kind of data to function, because minhaFuncao() requires a parameter of type TipoDeDado and will fail if you pass null or…
-
2
votes2
answers13078
viewsA: run git pull without asking for a password
I remembered that I already had this problem and I found the solution here: https://stackoverflow.com/a/7773605/1001109 It may be because you have the wrong URL, using https or git instead of ssh:…
gitanswered Ricardo Moraleida 4,005 -
0
votes2
answers165
viewsA: Java Script, PHP - Sends ID of a php loop to a Javascript function
Just pass the code as a function parameter: //código do link (removi as partes desnecessárias pra resposta) <a href="#"…
-
3
votes2
answers117
viewsA: event with jquery
Answer edited after question changed: One way to resolve this is to record dynamic events. Within your defined click you record the click for the dynamically named element. That may be enough or…
jqueryanswered Ricardo Moraleida 4,005 -
2
votes3
answers1108
viewsA: Error while creating Wordpress post
Go on Settings -> Reading Settings and select another page from select "Posts page". This warning appears precisely because as this page is selected there, its content will be replaced by its…
wordpressanswered Ricardo Moraleida 4,005 -
0
votes2
answers295
viewsA: wp_pagenavi does not work in Category.php
wp_pagenavi is failing because your query is being overwritten with query_posts(). The Internet will tell you otherwise, but it’s never a good idea to use query_posts() because this function messes…
-
0
votes1
answer53
viewsA: Wordpress: Image placed in header.php some in the internal pages
You are using a relative URL, so when you exit the home page,wp-content/themes/meu_tema/asserts/imagens/logo.png is being added to the URL of the page you are on, so it doesn’t work. The quick (and…
-
0
votes1
answer112
viewsA: Shortcode for Wordpress
For the shortcode to work you need to call a filter, or activate it directly. The simplest way is to call the filter the_content, that applies all the filters defined for the default content,…
-
0
votes2
answers317
viewsA: receive json to make my Echart dynamic
It all depends on how you are providing this information in PHP. A simple way would be to add a chamda to jQuery.get() to seek such information. var echartLine =…
-
0
votes2
answers363
viewsA: Advanced Custom Fields Taxonomy not showing!
The problem is that you gave the wrong names to the files. Save the link from Hierarchy of Templates and consult whenever you need. In your case you created a taxonomy categorias, associated with…
-
1
votes1
answer201
viewsA: infinite scroll with msg at the end of the results
To not repeat the message just check if you have entered the message before. Preferably before calling ajax, to save resources. $(document).ready(function() { var win = $(window); // Each time the…
-
1
votes2
answers78
viewsA: Change date language captured in RSS
If strtotime($feed[$x]['date']) is ok and returning the correct timestamp, just change: $date = date('l F d, Y', strtotime($feed[$x]['date'])); // Thursday November 10, 2016 for $date =…
-
0
votes1
answer36
viewsA: I need to create a slider shortcut that allows the inclusion of additional information
The shortcut used there is very simple, only a div with position: fixed and an external link. The rest is CSS positioning: body { height: 3000px; } .link { position: fixed; top: 50px; left: 0;…
-
2
votes1
answer1930
viewsA: Php array check for values or keys
If you need to check separately you can use array_key_exists(), or isset() for the name of the key, and Empty() for the value. if( array_key_exists( 'VirTotalPI', $meuArray ) ) { // chave existe if(…
-
0
votes2
answers201
viewsA: Add header and footer in txt file generated via phptxt
Use an array to group the data in the correct sequence, then join it with join() before writing to the archive; <?php while($data = mysql_fetch_array($querymail)) { $log = str_pad($data[0], 10,…
-
5
votes2
answers729
viewsA: PHP json_encode with Boolean and decimal values
Bringing here the code I have written in the comments. A simpler solution than trying to coordinate the flags json_encode() is to treat values before moving to function. In that case, if ativo must…
-
1
votes3
answers993
viewsA: List files in a folder containing a specific word in the name
To list files in one or more folders you can use glob() // codigo do usuário $codigo = '1234'; // arquivos .pdf na pasta /path/ começados com holerith com 1234 no nome. $arquivos =…
-
1
votes1
answer94
viewsA: Table with select and Submit
<select class='form-control' name='statusm'> All your selects have the same name, so only the latter is recognized. You can use name="statusm[]" to send them all as an array (which is what it…
-
1
votes1
answer793
viewsA: Add Parameters to Wordpress URL
How to do this depends a little on how links to external articles are generated. If you have control of them, just put something like this: $url_dinamica = $_REQUEST['REQUEST_URI']; $query =…
-
4
votes2
answers105
viewsA: Logical operators in form validation with php
need only one of the fields (any one) be required. Based only on this rule, the code below will work: if ( !empty($whats) || !empty($telefone) || !empty($email) ) { // válido, pelo menos um campo…
-
1
votes1
answer218
viewsA: Return "Undefined" Ajax PHP
Javascript does not receive anything because it is missing "print" the answer in the PHP output. I put an example to improve, sending headers to identify the response as JSON:…
-
5
votes1
answer57
viewsA: GIT central repository + external server communication
The process of executar um comando pra subir as alterações is called Deploy. You can do this by writing your own git hooks or integrating an external tool. There are several tools that integrate…
-
3
votes4
answers381
viewsA: Transform Multiple arrays into an array only
Once I needed it and used it this solution. function flatten($array) { $return = array(); array_walk_recursive($array, function($a) use (&$return) { $return[] = $a; }); return $return; } This…
-
4
votes3
answers297
viewsA: Git alias for the current branch name
Solution Found following the steps of Diego Garcia’s reply, I arrived at the following configuration, which allows me to never need to write down the name of the current branch: [alias] branch-name…
gitanswered Ricardo Moraleida 4,005 -
4
votes1
answer207
viewsA: Generate Table with PHP Group Index
A simple solution is to aggregate the real estate name into a list and check with in_array() if the unit in question already has a title line, thus: // Cria uma lista para recolher os nomes dos…
-
1
votes2
answers1493
viewsA: include tag and category in wordpress search results
I don’t know why this question came to me today, but it has over 200 views and there’s no answer to something reasonably simple that’s very useful, so here it goes: No need to use $wpdb and tamper…
-
4
votes3
answers297
viewsQ: Git alias for the current branch name
In my work it is very common to switch between Feature branches and Stage/develop branches several times during the day. And many of these times I need to write or use a tab to complete the branch…
gitasked Ricardo Moraleida 4,005 -
1
votes1
answer453
viewsA: Detect SHIFT key pressed and direct mouse click
Use Event.shiftKey for that reason: With jQuery $(document).click(function(event) { if (event.shiftKey) { // tecla shift console.log("shift+click") } if (event.ctrlKey) { // tecla Ctrl…
-
7
votes1
answer126
viewsA: How to delete elements from a jQuery collection?
With jQuery you can use the function not(). It allows you to select a larger group of objects and remove from them the ones you don’t want. For example: // seleciona todas as divs exceto as que tem…
-
1
votes2
answers770
viewsA: Jquery function click on dynamic PHP links
You do not need to call the click event by button ID. You can give a common class to everyone (e.g.. curtir) and capture all clicks there. After captured you use $(this) to identify which button was…
-
0
votes2
answers59
viewsA: Scroll effect with opacity works but with transfform does not
There were two problems with your code. One was that you were passing transform: 90deg instead of transform: rotate(90deg). The other is that the function that calculates the rotateX was always…
-
1
votes2
answers660
viewsA: Return getInstallments Pagseguro
You just need to iterate over the array within visa: var parcelas = getInstallments(), visa = parcelas.installments.visa; for( var i = 0; i < visa.length; i++ ) { var quantidade =…
-
3
votes2
answers284
viewsA: Dar Foreach label on Chartjs / Canvas - Codeigniter
Instead of creating the javascript array structure in your hand, let it json_encode() do this for you. Just create the list of names and let the function print the formatted array: labels: <?php…