Questions tagged [underscore]
JavaScript library for functional programming that doesn’t extend built-in JavaScript objects.
17 questions
2
votes
1
answer
36
views
Javascript code inside "<# #>" in core WordPress files .php
I found some interesting embeding JavaScript mix with HTML in WordPress php files, for instance:
<?php // Template for the Attachment Details two columns layout. ?>
<script type="text/...
3
votes
2
answers
2k
views
Issue with using Underscore in Wordpress
I have read in another SO post that Underscore.js is including in Wordpress by default. I am using it to test if a variable is defined but get this in the browser console:
pluginAdminPage.js:32 ...
0
votes
2
answers
281
views
underscore template dynamically remove row Jquery
I have this underscore template to add and delete row :
<#
jQuery( document ).ready( function() {
jQuery( '.add-ingr' ).click( function() {
jQuery( '#re-ingr .ingr' ).append( '<div>&...
0
votes
1
answer
367
views
Render repeatable widget fields properly with Backbone.js
I wanted to create widgets with repeatable fields for testimonials, time tables etc..
I recently stumbled up on this tutorial from codeable.io. I have some good experience with standard backbone.js ...
2
votes
1
answer
352
views
WP Customizer JS Template not saving color field
I'm trying to create a custom typography control, I'm having problem saving the value of the color, please take a look at my code:
<?php
class Customizer_Typo_Control_Typography extends ...
0
votes
2
answers
5k
views
How to use underscore.js in WordPress Admin
I am trying to use underscore in my WordPress Admin. This is what I have done: I enqueue a script in the very end of the page, like so:
function load_admin_scripts() {
wp_enqueue_script( "my-admin",...
1
vote
4
answers
5k
views
How to Dequeue All WordPress Assets
I want to dequeue all styles and scripts that are loaded on the front-end (EG. not the admin panel) by default.
I found this function, but am not sure how to utilize it to accomplish my goal.
I'm ...
0
votes
1
answer
8k
views
Replace Underscore (_) on Space ( )
I use the plugin "Auto Post With Image Upload"
For example I load an image with name "Image_Name"
then plugin creates a post with name "Image_Name"
Now the question: How to remove Underscore (_) in ...
6
votes
1
answer
3k
views
Open media frame and select an attachment
I'm using the following piece of code to open a media frame when clicking a link with a data-attachment_id attribute. This attribute holds the id of an attachment that I want to select when the frame ...
1
vote
2
answers
629
views
Remove H1 / title / Underscore - without CSS
I have tried searching, and tried a few options, but I'm not able to remove the H1 / title / Underscore for specific pages.
I don't want use CSS. I would like to remove it via functions.php or in ...
5
votes
1
answer
1k
views
Can I add custom attributes while adding inline scripts?
I need to inject some underscore templates into admin screen without modifying the core. The templates look like this:
<script type="text/template" id="template-123">
<div class="section ...
1
vote
3
answers
6k
views
WooCommerce: Adding Order Item Meta Data That's Hidden
I was under the impression that if you add an underscore to your meta_key, it would be hidden from the Admin and subsequently the Order Receipts, etc.
But, mine are showing? I don't understand what's ...
3
votes
1
answer
996
views
What type of template are WP media-modal's templates?
I was looking at the Wordpress templates (html that's written to the page instead of awkwardly adding strings in JS).
There are a lot of templates like this in a post editor for example:
<script ...
1
vote
1
answer
391
views
Customizer Ajax
This is the JavaScript code used in the underscores theme to preview any change of the setting value without reloading the previewer:
// Site title and description.
wp.customize( 'blogname', function(...
0
votes
2
answers
2k
views
Hook into backbone to add js to wp-admin -> media library?
I've enqueued a .js file on the "Media Library" page (upload.php). I need to hide and manipulate a few of the thumbnails on the page using JS only ( I'm not looking for workarounds ).
The elements ...
0
votes
1
answer
3k
views
Getting custom post type author and date published
In underscores I can get my custom post type just fine with pre get posts along regular blog posts. However the date published and author does not display. How can I modify my template tag (...
4
votes
1
answer
2k
views
Using Underscore Templates in WordPress
I've noticed that since WP 3.5 that we now have the Backbone.js and Underscore.js libraries included. The new Media Modal uses Underscore templates and I was wondering how would I be able to insert ...