Answers for "wordpress"

PHP
2

wordpress wpdb

<?php
// 1st Method - Declaring $wpdb as global and using it to execute an SQL query statement that returns a PHP object
global $wpdb;
$results = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}options WHERE option_id = 1", OBJECT );
Posted by: Guest on June-12-2020
14

wordpress

# Download WordPress Using wp-cli
wp core download

or 

just download zip 

https://wordpress.org/download/
Posted by: Guest on February-25-2021
7

wordpress

You are a coder. You don't need wordpress.
Posted by: Guest on August-13-2021
1

wordpress

/*include css from child and parent theme | style.css not updating on WordPress*/

function mychildtheme_enqueue_styles() {

    $parent_style = 'parent-style';
    wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
    wp_enqueue_style( 'custom-style', get_stylesheet_directory_uri() . '/custom-style.css', array(), rand(111,9999), 'all' );
    wp_enqueue_style( 'custom-style', get_stylesheet_directory_uri() . '/style.css', array(), rand(111,9999), 'all' );
    
}

add_action( 'wp_enqueue_scripts', 'mychildtheme_enqueue_styles' ); // register hook
Posted by: Guest on July-19-2021
0

wordpress

<?php
add_action( 'admin_init', 'my_admin_samplepost' );
function my_admin_samplepost() {
    add_meta_box( 'samplepost_meta_box', 'Car Details', 'display_samplepost_meta_box','samplepost', 'normal', 'high' );
}
function display_samplepost_meta_box( $samplepost ) {
    ?>
    <h4>General Details</h4>
    <table width="100%">
        <tr>
            <td style="width: 25%">Monthly Paymeny</td>
            <td><input type="text" style="width:425px;" name="meta[payment]" value="<?php echo esc_html( get_post_meta( $samplepost->ID, 'payment', true ) );?>" />
            </td>
        </tr>
        <tr>
            <td>Price ($)</td>
            <td><input type="text" style="width:425px;" name="meta[price]" placeholder="$" value="<?php echo esc_html( get_post_meta( $samplepost->ID, 'price', true ) );?>" />
            </td>
        </tr>
        <tr>
            <td>Milage</td>
            <td><input type="text" style="width:425px;" name="meta[milage]" value="<?php echo esc_html( get_post_meta( $samplepost->ID, 'milage', true ) );?>" />
            </td>
        </tr>
    </table>
<?php 
}
add_action( 'save_post', 'add_samplepost_fields', 10, 2 );
function add_samplepost_fields( $samplepost_id, $samplepost ) {
    if ( $samplepost->post_type == 'samplepost' ) {
        if ( isset( $_POST['meta'] ) ) {
            foreach( $_POST['meta'] as $key => $value ){
                update_post_meta( $samplepost_id, $key, $value );
            }
        }
    }
}
Posted by: Guest on July-07-2021
-1

WordPress

- Supports WPForms
- Fixed Social Counter Issue
Posted by: Guest on July-28-2021

Browse Popular Code Answers by Language