Posts by RFL • 6,205 points
308 posts
-
2
votes3
answers274
viewsQ: Add javascript to Wordpress plugin
I registered my Javascript file in my plugin but the functions of click and etc. do not work. I registered my main plugin file with the action: function add_scripts_to_plugin() { wp_enqueue_script(…
-
0
votes2
answers946
viewsA: Make border-bottom stand on the same width as text
The tag h3 has the size of 1.3em, so you can use this measure to configure the border-bottom: border-bottom: 1.17em solid blue; Most browser rendered fonts in the following sizes: h1 é 2 em h2 é 1.5…
-
2
votes1
answer691
viewsQ: List current category/subcategory subcategories and posts
In my file category.php I have a layout where I have a side menu where the subcategorias of categoria current and a <section></section> where the current posts should be displayed…
-
4
votes2
answers55
viewsA: What’s the difference from . to -> in PHP?
The point (.) in the PHP is used to perform concatetion of strings as in the example below: $nome = 'Meu nome'; $sobreNome = 'Meu sobrenome'; echo $nome.$sobreNome // Saida: Meu NomeMeu sobrenome //…
-
1
votes1
answer49
viewsQ: How to define CSS scope in wordpress?
Even using the function body_class() which returns the page name or the id by applying a certain rule in css some elements in other pages change, for example: Home: <body <?= body_class();…
-
1
votes2
answers627
viewsA: criticise error when CEP is invalid (via CEP )
You can use the function hasOwnProperty() to check if there is the "error" Indice in the value returned by API; var json = JSON.parse(ajax.responseText); if (json.hasOwnProperty('error')) {…
-
1
votes3
answers242
viewsA: How to enable click on entire cell of a table opening file on a new page
you can use the function window.open(), being as follows; $('td[data-url]').on('click', function(){ var url = $(this).data('url'); window.open(url, '_blank'); });…
-
2
votes1
answer364
viewsA: How to change the default name of an eloquent column
When you declare the relationship between the models you have the second and third parameter of the relationship function to carry out this change to that convention, for example: public function…
-
0
votes0
answers420
viewsQ: Recover data from firebase
I’m creating an app with react and currently need to recover some data from database using the library of firebase, for this I created a module that performs the configuration: Filing cabinet:…
-
4
votes5
answers2126
viewsA: function to count Divs quantity
To select ALL as divs you can simply use the selector with: var divs = $('div'); // Armazena um `NodeList` com todos os elementos Amount: var qtd = divs.length; // Numero inteiro da quantidade de…
-
1
votes2
answers104
viewsA: json_decode($data) PHP
You can use the function json_decode passing the second parameter as true so that all may be converted to array associative. $geojson = '{"type": "FeatureCollection","crs": {"type":…
-
2
votes2
answers925
viewsA: Using $this in POO PHP
Basically the this refers to the class itself. Understand it this way: class Teste { public $testando; public function VamosTestar(){ $this->testando = false; //estaClasse->testando ou…
-
0
votes3
answers691
viewsA: How to correctly format a monetary value?
You can use the function preg_replace or str_replace, see below with preg_replace: echo preg_replace('/^[0-9,]/', '', $valor); // Saída: 1500,95…
-
-1
votes2
answers745
viewsA: How to format php date, to display 'Today at 00:00' and 'Yesterday at 00:00'?
You can capture the difference between days and check if it is >1, 1 or 0, being: > 1: days that have passed (difference) 1: A day apart (yesterday) 0: Today $today = new…
-
1
votes1
answer482
viewsA: Object disappear at a certain place on the page
Your logic is right, you just forgot to pick up some values like the distance from the top div "target". var publicidade = $('.publicidade'); $(window).scroll(function() { // Distancia do scroll var…
-
0
votes3
answers1587
viewsA: Redeem input file name and assign input text
Search for type element file in your form and store the name of it in a variable, then assign to the value of the type input text. If you set a name for your form, you will not need to select the…
-
0
votes1
answer37
viewsA: I have an external PHP file and would like to know if it is possible to link to an HTML file
Are there any functions to include files within other files. require_once require include include_one what you need to do is use the tags php inside the archive html and use these functions, for…
-
0
votes1
answer62
viewsA: Swap data-zoom and src content without jquery
I’ve separated the tasks into parts so you can understand what needs to be done. Add an event listener in the smaller images Swap the main image when clicking on smaller images is detected Knowing…
-
2
votes1
answer294
viewsQ: border with alternating colors (no gradient)
On an edge of a div (border-bottom) i need to apply more than 1 color but without using the effect of degrade that mixes colors. Image for example: With the effect of degrade I know how to do but…
-
5
votes2
answers81
views -
1
votes2
answers321
viewsA: Show Image before saving to bank
I have a package ready to use (contains version jQuery) https://www.npmjs.com/package/simple-upload-preview It is basically the same code that was once used as a response.…
-
7
votes1
answer51
viewsQ: Operator "and" for class assignment
Looking at some Github repositories I found this repository for generation of boletos with php and within the class Cedente I was struck by the use of the word and within the function construct in…
-
1
votes1
answer32
viewsQ: Export function using third party package
I have a code snippet that I use to consume a API and use this same chunk in several files. So I created a module to export such a configuration: 'use strict' // Module to access woocommerce API…
-
1
votes2
answers53
viewsA: Find key and corresponding value in text file
Instead of using file_get_contents() you could use too fopen(). $arr = array(); $file = fopen('texto.txt', 'r'); while (!feof($file)) { $line = fgets($file); $arr[] = explode(' ', $line); }…
-
2
votes1
answer339
viewsA: How to pull the 4 most recent or visited wordpress posts
To find the most recent posts you can use the function wp_get_recent_posts, this function accepts as first parameter an array and as second parameter "how you want the result", but I believe that…
-
2
votes1
answer488
viewsA: Pull image from post worpress
For display of images inside the loop wordpress, you can use the function the_post_thumbnail(). If you want to only take the image of a particular post outside the loop, use the function…
-
0
votes1
answer185
viewsA: $_FILES returning empty
the function serialize() does not include fields of type file in the generated "query string", suppose in your form you had 2 fields of the type text, thus the serialize() would generate a string…
-
0
votes1
answer1218
viewsQ: Autoload of Poser does not find class
I registered the autoload in the composer.json "autoload": { "psr-4": { "Racioly\\MeuPackage\\": "src/" } } I created a folder called test at the root of the project, and also created a file…
-
2
votes0
answers75
viewsQ: array_filter in array inside Simplexml object
I have the following object: object(SimpleXMLElement)#2 (1) { ["cinema"]=> array(82) { [0]=> object(SimpleXMLElement)#4 (11) { ["@attributes"]=> array(2) { ["id"]=> string(3) "716"…
-
1
votes2
answers62
viewsA: PHP Comparison between fields
You can use if's for verification, an example follows below: if (strlen($postcomment) >= 20 && empty($uploaded)) { // Veririca se o campo $postcomment tem mais de 20 caracteres e se o…
-
0
votes1
answer28
viewsQ: Comparison of ID in XML elements
I’m doing a check between 2 ids of 2 different elements in XML, but when I make the comparison the result is always false even though the gettype is the same result and the number is also the same…
-
2
votes2
answers2549
viewsA: Codeigniter + Pagseguro
To submit the post there are 2 methods: the function file_get_contents (Yes it’s weird, I know), and the function curl_. The function file_get_contents send a POST as long as the second parameter is…
-
0
votes1
answer37
viewsA: Identify cities or other subjects
You can create a file that makes only one return in a giant array with all names or directly query an API City Json to use with the file API with city acronyms To popular the other select make a…
-
3
votes1
answer1036
viewsA: Undefined variable: users
You need to pass the variable $user through function view() $user = \App\User::all(); return view('painel', ['users' => $user]); The second parameter of view() is a array with the index being the…
-
1
votes1
answer393
viewsQ: Encoding treatment in XML
I’m trying to make a request for a URL that contains a return on XML with the function simplexml_load_file('url') and all I get is falsewhen I debug using var_dump. $xml =…
-
2
votes1
answer29
viewsQ: Nodejs module running before the Eventlistener
I’m creating a module for node and by performing some tests with the eventListener of the kind change in a field of the kind file, the module is executed before a frame is inserted into the field.…
-
0
votes2
answers238
viewsA: Generate Image Thumbs Before Uploading
You can use the class FileReader javascript. This code has been implemented and changed based on another question. See the source! function readURL() { if (this.files && this.files[0]) { var…
-
0
votes1
answer193
viewsA: PHP Warning: imagecreatefromjpeg()
The first error concerns a division by 0 PHP Warning: Division by zero in ... The second error concerns an invalid dimension in the function imagecreatetruecolor() since the variable $altura problem…
-
1
votes1
answer2081
viewsA: How can I place a logo on the same line as a flexbox navbar?
Place content of h1 within the ul navigation. <nav> <ul class="navigation"> <li class="brand"><img src="http://placehold.it/50x50" alt="Instituto Feira Livre"></li>…
-
0
votes2
answers451
viewsA: Hover one element and capture another tag
In css there is no way to change the color of the previous item just change the color of the items abaixo of dentro element, I suggest you change the order of the elements so you can use the marker…
-
1
votes1
answer653
viewsQ: Adjust width to border of an element
How can I make it so that the black line does not occupy the full width of the element tr? I’d like to narrow down a little bit from the left but with border-width behavior is another. <tbody>…
-
0
votes3
answers92
viewsA: Align vertical giving error!
You can use the property display: flex to facilitate alignment, see: .login { display: flex; justify-content: center; // Alinha ao centro horizontalmente align-items: center; // Alinha ao centro…
-
0
votes1
answer149
viewsQ: Run Appimage background file on Ubuntu
I downloaded the application cerebro for Ubuntu 16.04 but to run it I always need to open the terminal and write: `./cerebro-0.2.6-x86_64.AppImage` And then the software is opened but the terminal…
-
1
votes1
answer600
viewsA: Filter Array and return a new array with the objects that have been filtered
At first you can use the function filter to accomplish the task, for example; const inventors = [ { first: 'Albert', last: 'Einstein', year: 1879, passed: 1955 }, { first: 'Isaac', last: 'Newton',…
-
3
votes2
answers4724
viewsA: search text in all files of a library
In the sublime text you can use the CTRL + SHIFT + F, the fields that will appear: Find - The text you want to find Where - Where the archives are located (<project> is the default) Replace -…
-
0
votes1
answer1540
viewsA: Collect Wordpress category name
The function get_cat_name returns a string as reported in the documentation, and on your line where you tag a you’re not using the echo nor <?= to display the name. <a href="<?php echo…
-
1
votes0
answers18
viewsQ: Toggle slide using Jquery
I have 3 links with 3 contents associated with them, when I click on one of the links to div with the corresponding content is displayed. Case another div that is not corresponding is already being…
-
3
votes3
answers922
viewsQ: Check external file loading with JS
My home page has a video as background but in some moments the video takes to be loaded. In this situation I thought of creating a loading before the page is displayed, my doubt is how can I check…
-
0
votes0
answers136
viewsQ: Archive . htaccess being rewritten in Wordpress
The site has been presenting the error for some time: Your PHP installation appears to be Missing the Mysql Extension which is required by Wordpress. I checked with the hosting server and we noticed…
-
0
votes1
answer340
viewsQ: Slidedown effect with menus li
I’m trying to create an effect using css and jquery to a menu where the same will have the effect of "slidedown" when clicked on a given link, but even if I put the list inside a div with height: 0…