I always see these on my dashboard Notice: Undefined index: full in /home2/guyfancy/public_html/cafe4apps.net/wp-includes/media.php on line 215

Notice: Undefined index: full in /home2/guyfancy/public_html/cafe4apps.net/wp-includes/media.php on line 216

Notice: Undefined index: full in /home2/guyfancy/public_html/cafe4apps.net/wp-includes/media.php on line 217

Notice: Undefined index: full in /home2/guyfancy/public_html/cafe4apps.net/wp-includes/media.php on And recently it started showing up in front end as well

So, I have a few form fields like so:

<input name='mainStageSatOrder[theband][theid]' type='hidden' class='band-id' value='' />";
<input name='mainStageSatOrder[theband][theorder]' type='hidden' class='band-order' value='' />";

As you can see, these form fields (of which there are more, these are just examples of both types) create a multi-dimensional array like so (I hope, please correct me if I'm wrong):

Array (
[mainStageSatOrder] => Array
    (
        [theband] => Array
            (
                [theid] => 1
                [theorder] => 5
            )

        [theband] => Array
            (
                [theid] => 2
                [theorder] => 8
            )
    )
)

I want these values to use the update_post_meta function to update the relevant fields when the page update is submitted. I know I can hook into the submit action post_submitbox_start action which I understand just fine.

What I'm not sure on, is what the PHP might be once the submit button is clicked. What I want to happen is that when the submit button is clicked, the multidimensional array is looped through using a foreach loop and for each 'theband' sub-array, the two values are used in the update_post_meta function.

foreach(???) {
    update_post_meta( 1, 'theorder', '5' ); //where 1 and 5 are values passed from the MD array
}

So, the process goes:

1) User clicks publish/update button 2) All values from all fields are passed into the multidimensional array 3) The MD array is looped through and, using update_post_meta, the relavent data is updated 4) Confirm yes/no

Thanks.

I'm working on a travel site where there are three parameters: destinations, activities and packages.

Destinations mean the country to travel like: United States, Singapore, Switzerland etc.

Activities are the activities that can be performed inside that country like: hiking, rafting, tour, climbing.

And, package include actual package inside that activities like: hiking in Switzerland, Rafting in Nepal etc.

So, destination may contain number of activities and activities may contain number of packages

I thought of two ways: one creating three post type: destinations, activities and packages and maintaining relationship among them.

Another way is: creating two taxonomies: destinations and activities for single post type package. And maintaining relationship among them.

Which way is better? Is it possible to maintain relationship as my requirement in WordPress? If yes, it'll be nice if someone can give me some clue. Or there is any other solution.

I have a shortcode from a plug-in called Pods that is used like

[pods-form name="user" id="" fields="my_field, my_field_2, my_field_3"] 

Parameter name contains the name of the custom post type (here: enhanced the WP user post type). Parameter id now shall receive the user ID of the currently logged in user. The page containing this shortcode is only available to logged-in users. How to add the current user ID as a variable to this shortcode?

I'm looking for something like this

[pods-form name="user" id="[email protected]_ID}" fields="my_field, my_field_2, my_field_3"]

I am developing a coming soon page using bootstrap and I have images on a javascript script and it's suppose to show on the front page but it's not. I have tried:

<img src="<?php echo (get_template_directory_uri()); ?> /img/....", it's not working.

I have about 5 images and I don't think the above function will call in the images one at a time. please how do I upload this images?

I've got a wordpress website with a theme (Zeeminty) that shows all the pages of the mobile hamburger menu by default as such:

Red = top level list items

Red = top level list items

Now what I would very much like is to be have all the children collapsed upon opening the hamburger menu, and be able to click on one of the list items (custom links with "#") to expand the children (two levels down). Can anyone tell me in detail how I could do this in wordpress with my theme?

I've about a dozen hours loosely over the last year trying to find a solution, but my coding knowledge is just lacking. By messing around in the stylesheet I've only been able to collapse the children until their parent/ancestor is active with:

#mainnav-menu li > ul {
display: none !important;
}
#mainnav-menu li.current-menu-item > ul {
display: inline-block !important;
}
#mainnav-menu li > ul > li.current-menu-item > ul {
display: inline-block !important;
}
#mainnav-menu li.current-menu-parent > ul {
display: inline-block !important;
}
#mainnav-menu li.current-menu-parent > a{
border-left: 2px solid #ddd;
border-right: 2px solid #ddd;
border-top: 1px solid #ddd;
border-bottom: 2px solid #ddd;
}
#mainnav-menu li.current-menu-ancestor > ul a{
border-left: 2px solid #ddd;
border-right: 2px solid #ddd;
border-top: 1px solid #ddd;
border-bottom: 2px solid #ddd;
}
#mainnav-menu li.current-menu-ancestor > ul {
display: inline-block !important;
}

This works by somewhat by loading the first child page upon clicking, but it still doesn't really make mobile navigation all that smooth...

Is there a hook or another way I can update a custom field that is not associated with the current post?

I have created a cmb2 select field of WP users where the user ID is the select field value.

In addition to saving the cmb2 post meta I need to update a custom field in the user profile that matches the ID of the selected user.

I don't need help coding the part that updates the user profile, I am looking for help in how to trigger the update function. It seems like there are a few actions and filters that might work.

im trying to make the pagination work in my portfolio page, whenever i click older entries it takes me to an error page but my URL is show ...page/2. i have spent days going thru forums on how to fix this. PLS HELP!!!!

my code below, (**php files)

**register_portfolio.php 

<?php 
    $portfolio = new CPT(array(
    'post_type_name' => 'portfolio',
    'singular' => __('Portfolio', 'ninetyoneproductions'),
    'plural' => __('Portfolio', 'ninetyoneproductions'),
    'slug' => 'portfolio'
),
    array(
    'supports' => array('title', 'editor', 'thumbnail', 'comments', 'post-formats'),
    'menu_icon' => 'dashicons-portfolio'
));

$portfolio->register_taxonomy(array(
    'taxonomy_name' => 'portfolio_tags',
    'singular' => __('Portfolio Tag', 'ninetyoneproductions'),
    'plural' => __('Portfolio Tags', 'ninetyoneproductions'),
    'slug' => 'portfolio-tag'
));

**template-portfolio.php

<section id="content">
    <div class="container">
        <div class="row">
            <div class="col-lg-12 col-md-12">     

                    <div class="row">
                        <div class="portfolio-items">

                        <?php 
                            if ( get_query_var('paged') ) {
                                $paged = get_query_var('paged');
                            } elseif ( get_query_var('page') ) { // 'page' is used instead of 'paged' on Static Front Page
                                $paged = get_query_var('page');
                            } else {
                                $paged = 1;
                            }
                            $query_args = array(
                                'post_type' => 'portfolio', 
                                'posts_per_page' => get_option('posts_per_page'),
                                'paged' => $paged
                            );
                            // the query
                            $the_query = new WP_Query( $query_args ); ?>

                            <?php if ( $the_query->have_posts() ) : ?>

                            <!-- the loop -->
                            <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>

                                <div class="col-sm-6 col-md-4 item">
                                    <div class="thumbnail ">
                                        <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
                                            <?php the_post_thumbnail('single-post-thumbnail');  ?>
                                        </a>
                                        <br>
                                        <h4> <a href="<?php the_permalink(); ?>"> <?php the_title(); ?></a></h4>
                                        <?php edit_post_link( ' Edit', '<div><i class="fa fa-pencil"></i>', '</div>' ); ?>
                                    </div>
                                    <br>
                                </div>                                  

                                <?php endwhile; ?>
                                <!-- end of the loop -->

                                <?php if ($the_query->max_num_pages > 1) { // check if the max number of pages is greater than 1  ?>
                                      <?php
                                        $orig_query = $wp_query; // fix for pagination to work
                                        $wp_query = $custom_query;
                                        ?>
                                    <nav class="prev-next-posts">
                                        <div class="prev-posts-link">
                                        <?php echo get_next_posts_link( 'Older Entries', $the_query->max_num_pages ); // display older posts link ?>
                                        </div>
                                        <div class="next-posts-link">
                                        <?php echo get_previous_posts_link( 'Newer Entries' ); // display newer posts link ?>
                                        </div>
                                    </nav>
                                     <?php
                                        $wp_query = $orig_query; // fix for pagination to work
                                        ?>
                                <?php } ?>

                                <?php
                                        wp_reset_postdata(); // reset the query 
                                    else:
                                        echo '<p>'.__('Sorry, no posts matched your criteria.').'</p>';
                                    endif; ?>
                        </div>
                    </div>

            </div>
        </div>
    </div>
<section>

**single-portfolio.php

<?php
/**
 * The template for displaying all single portfolio posts
 *

 *
 * @package 91-Productions
 */

get_header(); ?> 

    <section id="inner-headline">
    <div class="container">
        <div class="row">
            <div class="col-lg-12">
                <ul class="breadcrumb">
                    <li><a href="/localhost/"><i class="fa fa-home"></i></a><i class="icon-angle-right"></i></li>
                    <li><a href="localhost/portfolio/">Portfolio</a></li>
                    <li class="active"><?php the_title( '<span class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></span>' ); ?></li>
                </ul>
            </div>
        </div>
    </div>
    </section>

    <section id="content">
        <div class="container">
            <div class="row">
                <div class="col-lg-12 col-md-12" id="pi">

                <?php while ( have_posts() ) : the_post(); ?>

                        <?php get_template_part( 'template-parts/content', 'portfolio' ); ?>

                         <!--the_post_navigation();-->
                </div>

                <div class="col-lg-12 col-md-12"
                        <?php 
                            // If comments are open or we have at least one comment, load up the comment template.
                            if ( comments_open() || get_comments_number() ) :
                                comments_template();
                            endif;
                        ?> 

                        <!--// End of the loop. -->
                        <?php endwhile; ?>      

                </div>

            </div>
        </div>
    </section>

<?php

get_footer();

**content-portfolio.php

<?php
/**
 * The template for displaying all portfolio contents
 *
 * @package 91-Productions
 */
?>

<?php
    $productionDesc             =   get_field('production_name');
    $AwardDesc                  =   get_field('award');
    $directorName               =   get_field('director_name');
    $AssistantCamera            =   get_field('assistant_camera');
    $location                   =   get_field('location');
    $actors__actress_model      =   get_field('actor_actress_model');             
?>

<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    <header class="entry-header">
        <?php the_title( '<h2 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h2>' ); ?>
            <hr>
    </header> 
                    <?php if (has_post_thumbnail()) { ?>
                        <div class="post-image" >
                            <?php the_post_thumbnail(); ?>
                        </div>
                    <?php } ?>

                 <div class="col-lg-8 col-md-8">
                    <div class="post_body" id="ct">
                        <?php the_content(); ?>
                    </div> <br>
                    <a href="#" class="btn btn-warning">Hire Us Now</a>
                     <?php edit_post_link( ' Edit', '<div><i class="fa fa-pencil"></i>', '</div>' ); ?>
                </div>

                <div class="col-lg-4" ID="pas">
                    <aside class="right-sidebar">
                    <div class="widget">
                        <h5 class="widgetheading">PRODUCTION</h5>
                        <p><?php echo $productionDesc ?></p>
                    </div>
                    <div class="widget">
                        <h5 class="widgetheading">AWARDS</h5>
                        <p><?php echo $AwardDesc ?></p>
                    </div>
                    <div class="widget">
                        <h5 class="widgetheading">DIRECTOR</h5>
                        <p><?php echo $directorName ?></p>
                    </div>
                    <div class="widget">
                        <h5 class="widgetheading">ASSISTANT CAMERA</h5>
                        <p><?php echo $AssistantCamera ?></p>
                    </div>
                    <div class="widget">
                        <h5 class="widgetheading">LOCATION</h5>
                        <p><?php echo $location ?></p>
                    </div>
                    <div class="widget">
                        <h5 class="widgetheading">MODEL</h5>
                        <p><?php echo $actors__actress_model ?></p>
                    </div>
                    </aside>
                </div>


</article> 

I'm looking for some plugin that allows me to write entries with real names, but display them with designated "fake" names to protect the identity of both the writer and the people being written about without the writer doing manual mapping and replacement. I also don't want it to display without the plugin working. Like if the plugin no longer works then display "entry temporarily unavailable" or similar.

Example:

I went to the store with James today.

Would display as something like

I went to the store with Thomas today.

And it would hold James = Thomas in the database and never use Thomas for any other name.

On our production and staging servers, we're seeing the "WordPress News" feed show an error:

wordpress news error

After poking around in the WP codebase a bit, I've discovered that this is stored in the wp_options table as a "transient cache". I went ahead and deleted those caches in the database (and also tried deletion via the Transient API), but the feed continues to fail to load and then rewrites the failed cache at each load so the error persists.

My question is, what exactly is this feed load operation doing that it would fail on certain servers? My initial guess is that it's trying to write some sort of filesystem cache as well as the transient cache and there's probably a permissions error or something there.

Thoughts? This is the only place in the admin or site where this is happening AFAICT.

I'm creating a site where a central question will be posed on the front page with excerpted first-tier comments linking to a page with the full first-tier comment, presented almost as a post, with nested replies to that comment below. Why a comment as a post? Seemed like a good way to let users author content without giving access to the back end.

Where I'm having trouble is with those nested replies to a specific comment. I'm trying to keep things simple and use wp functions where possible. My approach was to build an array of all the replies to the specific comment and then pass that array in to wp_list_comments. Which all works, except for the nesting part; all replies are treated as at the same level, or tier. Obviously, I don't fully understand how wp_list_comments works.

Here's my loop to create the array of all replies to a specific comment (passed as $_GET[comment_id]):

$my_comments = array();
$args = array(
    'type' => 'comment',
    'status' => 'approve',
    'parent' => $_GET[comment_id],
);
$my_comments1 = get_comments($args);
if(!empty($my_comments1)) {
    $my_comments = array_merge($my_comments, $my_comments1);
    $x=1;
    $finished = false;
    while(! $finished) {
        foreach(${'my_comments'.$x} as $my_comment) {
            if($my_comment->comment_ID) {
                $args = array(
                    'type' => 'comment',
                    'status' => 'approve',
                    'parent' => $my_comment->comment_ID,
                );
                $x++;
                ${'my_comments'.$x} = get_comments($args);
                if(!empty(${'my_comments'.$x})) {
                    $my_comments = array_merge($my_comments, ${'my_comments'.$x});
                } 
                elseif(empty(${'my_comments'.$x})) {$finished = true;}
            }
        }
    }
} // if not empty

And here's how I'm displaying:

<ol class="commentlist">
    <?php wp_list_comments( array( 'style' => 'ol' ), $my_comments); ?>
</ol><!-- .commentlist -->

Any insight on how wp_list_comments works would be appreciated, as would any other big idea approaches to my goal of a first-tier comment presented as a post with replies to that comment nested below.

Am noticing that this function gets defined in wp-admin/includes/user.php

But my problem is, when new site admins get added from the Super Admin, I need a Customized email to be sent. The default body copy from: admin_created_user_email function will NOT simply do.

So, I'm having difficulty understanding where this function is being called from as I can't find the file(s)/hook(s) that call this function.

Please tell me that this is something that I can overwrite easily without having to rewrite any core files.

Basically, Super Admins create new sites, which in turn, may or may not create a new user. In both cases, where either new user gets created, or existing user becomes administrator, I need to edit the email that gets generated for this user that get the role Admin of a site in a multisite Wordpress install. The email should be triggered when Site gets created or whenever a user is given the administrator role from a Super Admin.

How is this possible? The function I need to change is this: admin_created_user_email and possibly another function, if user is edited to have administrator role from Admin area by Super Admin.

I've looked through various articles that I could find on this, but it seems they relate to when the user is going through registration on the site. That is not what I want, since Registration is disabled! Only Super Admins and Site Admins can create users. And only Super Admins can create administrator users.

Is this possible?

I am super new to this stuff, so it is likely that I am missing something that is pretty obvious. Changes I add to the child theme are not being displayed on the website. I am using the FOREAL theme.

Here is the staging version of the website.

http://rabbitholers.staging.wpengine.com/

One of the things I have tried is to get rid of the white shadow on the text across the center of the screen. To do that I added

.breadcrumb-wrapper.type1 .main-title h1, .breadcrumb-wrapper.type2 .main-title h1, .breadcrumb-wrapper.type1 .breadcrumb a, .breadcrumb-wrapper.type1 .breadcrumb .fa, .breadcrumb-wrapper.type2 .breadcrumb a, .breadcrumb-wrapper.type2 .breadcrumb .fa, .breadcrumb .current { color: #000; }

to the child theme.

Any idea what I am doing wrong?

http://ar.jokerleb.com/%d9%82%d9%88%d8%a7%d8%a6%d9%85-%d8%a7%d9%84%d8%a5%d8%b9%d9%84%d8%a7%d9%86%d8%a7%d8%aa/

is the correct translation for

http://www.jokerleb.com/ad-listings/

which is perfect, and polylang did it automatically. However the theme doesn't support polylang so I had to use the english URLs on all links and I don't know how to translate them to arabic using that plugin.

If another plugin provides such functionality I can use it. right now if you press on any link in the menu while using the arabic version, it's going to redirect you back to English.

I have a post type called usr_jardin with a custom field called sim_nuip. I would like to get the search to work for the title of the post and also by custom field . I try this but does not work me.

function searchfilter($query)
{
    $custom_fields = array("_post_title", "nuip");
    $searchterm = $query->query_vars['s'];
    $query->query_vars['s']="";

    if($searchterm != "")
    {
        $meta_query = array('relation' => 'OR');

        foreach($custom_fields as $cf)
        {
            array_push($meta_query, array('key'=> $cf,'value'=> $searchterm,'compare'=> 'LIKE'));
        }

        $query->set("meta_query", $meta_query);
    }

    if($query->is_search)
    {
        $query->set('post_type', array('post', 'usr_jardin'))
    }
    return $query;
}

add_filter('pre_get_posts','searchfilter');
add_action('save_post','add_title_custom_field');

function add_title_custom_field($postid){
    update_post_meta($postid, "_post_title", $_POST["post_title"]);
}

I am trying to accomplish the following:

  • User gets email with a special "company code" and URL
  • By clicking on the URL, he gets redirected to a form where the company code is pre populated.
  • Now this form can be submitted with the same value (in this case 123) only 5 times, from 01/05/2017 to 31/05/2017 (this point is where I need help or guidance)
  • If above rules are correct, the user gets redirected to another more extensive form.

Now this is just an example scenario.

I have tried to accomplish something similar with the coupon codes, that seem to have the exact functionality I want (Usage Limit and Expire date), but the coupon field can't be pre populated I think, and needs an extra "Apply" confirmation from the user (+ some pricing and total that I don't need). I also need to pass on that specific value (=company code); to the next form

I want the menu of this site to look like the menu of this site.

It's clear that they use display table and table cell but not sure how to implement it, been playing with css for a while, couldn't nail it. Didn't found a plugin that does the job but css should do. Do I have to create a custom menu layout? I think not.

I'm using a wordpress menu with this plugin, and the header.php

    <?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_id' => 'menu-header', 'fallback_cb' => false, 'container' => false ) ); ?>

    <a href="<?php echo esc_url( CP_ADD_NEW_URL ); ?>" class="obtn btn_orange"><?php _e( 'Post an Ad', APP_TD ); ?></a>

    <div class="clr"></div>

I am trying to insert pagination links into my custom post loop. However, whenever I click on a button to go to the next page it goes to a url like: http://example.com/services/property-portfolio/page/2. This just takes me to the first loop of posts. I tried doing http://example.com/services/property-portfolio/2 and that worked. How can I resolve this issue?

Beginning of loop:

<?php
                        $paged = ( get_query_var('page') ) ? get_query_var('page') : 1;

                        $args = array(
                            'post_type' => 'properties',
                            'posts_per_page' => 5,
                            'paged' => $paged
                        );
                        $carousel_num = 0;
                        $query = new WP_Query($args);

                        if ( $query->have_posts()) {

                            while ($query->have_posts() ) {
                                $query->the_post();
                                $id = get_the_ID();
                                $count = 0;
                                if(have_rows('images')):
                                    while(have_rows('images')): the_row();
                                        $count++;
                                    endwhile;
                                endif;
                                ?>

I have a custom post type for the user profile page. My client wants all users to update their profile at least once a month, so we want their profile (custom post) to be automatically set to draft after 30 days. They will then receive an email asking them to update the post. The post needs to be set to draft again 30 days after the last modified date and another reminder sent out, etc.

So far I have this code to expire the posts after 30 days of the published date, which doesn't seem to work. I assume I am missing something regarding the cron scheduling:

if ( ! wp_next_scheduled( 'run_post_expiration' ) ) {
    wp_schedule_event( time(), 'hourly', 'run_post_expiration' );
}    
add_action( 'run_post_expiration', 'expire_posts' );

function expire_posts() {
    global $wpdb;
    $daystogo = "30";
    $sql = "UPDATE wp_posts 
        SET `post_status` = 'draft' 
        WHERE `post_type` = 'profile' 
        AND DATEDIFF(NOW(), `the_date`) > '$daystogo')";
    $wpdb->query($sql);
}
add_action('init', 'expire_posts');

I have this code to set the post_date to the post_modified date, therefore enabling the code above to still work every 30 days:

function reset_post_date_wpse_121565($data,$postarr) {
    $data['post_date'] = $data['post_modified'];
    $data['post_date_gmt'] = $data['post_modified_gmt'];      
    global $post;
    if ($post->post_type == 'profile'){
        return $data;
    } 
}
add_filter('wp_insert_post_data','reset_post_date_wpse_121565',99,2);

The above code to modify the post_date does actually work, but it is also causing some problems with other post types which I wasn't expecting, so I think there may be an error somewhere.

Can anybody help me to get this to work? Or am I even going about this in the right way? Perhaps there is a better solution. I have tried the "Post Expirator" plugin, but this only works with the post_date; once someone has updated their profile once, it no longer works.

EDIT:

I edited the original code to set the posts to draft to this (based on some code I found elsewhere):

add_action( 'my_trash_hook', 'my_trash_hook_function' );
if (!wp_next_scheduled('my_trash_hook')) {
    wp_schedule_event( time(), 'hourly', 'my_trash_hook' );
}

function my_trash_hook_function() {
    global $wpdb;
    $daystogo = "1";
    $sql = "UPDATE {$wpdb->posts}
        SET 'post_status' = 'draft'
        WHERE 'post_type' = 'tests'
        AND DATEDIFF(NOW(), 'the_date') > '$daystogo')";
    $wpdb->query($sql);
}

I have another function set up to send me an email when the post is set to draft and another to send me an email when the post is published again.

What is happening is that when I log in to the site I am sent an email saying the post has been published, but not one saying the post was set to draft. Not sure if the two pieces of code are conflicting with each other or just plain wrong.

In a custom meta form, I have a place where the images that should be uploaded should be bigger than 1000px x 500px to show up well on the site.

This page can be edited by my client clients, so we cannot coach/monitor everybody.

Is there a way, while calling the media popup, to prevent the upload/selection of images that are smaller, in size, than a threshold?

WooCommerce has a simple way to pick "Featured" products by clicking a little star icon in the "Featured" column in the admin area.

I need to be able to filter and show only featured products in the admin area. Does anyone know of a straightforward way to do this?

I did some digging and it turns out this is done with meta key/values, where _featured is the key and the value is either yes or no.

Unfortunately, since it's not done with taxonomies like product categories, there is no way to use the filter functionality in the admin area to show only featured products. You can sort the featured column so they are all either at the top of bottom of the product list, but that's it.

I have a very simple theme to which I need to add custom-background support.

When I go into appearance -> customize, I am able to select a background image.

However, the background of the site never actually changes, and I can see that the output html contains

<body class="home blog logged-in admin-bar no-customize-support custom-background">

But there are no <style> tags to be seen.

Does anyone have any suggestions as to what may be going wrong?

header.php

<html>
<head>
    <title>Tutorial theme</title>
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <link href="<?php bloginfo('stylesheet_url'); ?>" rel="stylesheet">
</head>
<body <?php body_class(''); ?>>
    <div id="wrapper">
        <div id="header">
        <h1>HEADER</h1>
    </div>

functions.php

<?php
    $defaults = array(
        'default-image' => '',
        'default-preset' => 'default',
        'default-position-x' => 'left',
        'default-position-y' => 'top',
        'default-size' => 'auto',
        'default-repeat' => 'repeat',
        'default-attachment' => 'scroll',
        'default-color' => '',
        'wp-head-callback' => '_custom_background_cb',
        'admin-head-callback' => '',
        'admin-preview-callback' => '',
    );
    add_theme_support('custom-background', $defaults );
?>

I also tried simply adding add_theme_support('custom-background'); but no luck.

I am using version 4.7.5

I'm not entirely sure this is Wordpress' fault, but I figure I'd ask anyway and see if anyone else has experienced any problems like this before.

I'm trying to save an array to a wp_options table row. The data is coming from a custom metabox and is being saved when the save_post hook is triggered. I assumed this should do the trick:

update_option("myOptionName", $myArray);

I started getting 4(?!) of each value I saved. For instance:

$myArray = array("option1");
update_option("myOptionName", $myArray);
get_option("myOptionName"); 
// array([0]=>"option1", [1]=>"option1", [2]=>"option1", [3]=>"option1");

Needless to say, this behavior is extremely annoying. It works perfectly well with strings, but never arrays. I've tried to get around this by trying json_encode to store it as a string-y entity, but even that isn't working. The problem could very well be the legacy code I've inherited by taking on this project, but I see nothing pointing to save_post.

Has anyone ever seen a situation like this before?

EDIT: As requested ... the save function:

# SAVE BRICK DATA
function brick_update() {

// Verify if this is an auto save routine.
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
    return;
}

// Check permissions
if ( !current_user_can( 'publish_posts' ) ) { // Check for capabilities
    wp_die( 'Sorry, you do not have the capabilities access to this page. :(' );
}

if (!wp_verify_nonce($_REQUEST['brickupdate'], 'brickupdate')) {
    return;
}

$newView = array();
$currentView = get_option('ci_guidesbrick_posts');

if (!is_array($currentView)) {
    $currentView = (array)$currentView;
}

for (var i = 0, i < count($currentView), i++) {
    $newView[i] = $currentView[i];
}

$newView[] = $_REQUEST['postID'];

update_option('ci_guidesbrick_posts', $newView );   

}

I am trying to get post positions from categories and tags. All categories and tags are ordered with meta value on my website and the meta key is: option_overall_score

Well my plan is displaying position of a post from a category and a tag. I am working on it for hours but couldn't find a way to do it. There is a similar question on here but to be honest I am not familiar with db stuff much.

Is there any simple way to do it?

I am writing a new template file. I want to display recents posts from different categories in varying numbers in different divs as you scroll down the homepage.

I have written a WP_Query statement but each time I run the loop it I doesn't close. The next <div> after the loop always ends up displaying inside the loop.

In this example you can see that the text "latest" gets caught inside the loop. If you add another div of text afterwards its fine.

What am I missing?

Website is here:

test site

The code I have written is:

<?php 
/*
Template Name: Home News
*/ 
?>

<?php
$sidebar = kloe_qodef_sidebar_layout(); ?>

<?php get_header(); ?>
<?php get_template_part( 'title' ); ?>
<?php get_template_part('slider'); ?>



    <div id="container">
        <?php 
            $recent_posts_query = new WP_Query(array('post_type' => 'post', 'posts_per_page' => 8, 'category_name' => 'technology', 'Fashion-Beauty', 'Art', 'Watches-Jewellery', 'Travel',));
        while ($recent_posts_query->have_posts()){
        $recent_posts_query->the_post(); ?>
            <div class="masonryImage"><?php the_post_thumbnail();?></div>

            <?php } ?>
    </div>

    <div class="advert-container">
        <img src="http://104.244.127.200/~qmintest/wp-content/uploads/2015/12/Home-Shop-Single-Image-1-1.png" alt="advert">
    </div>

    <div class="text-header">
        <h1>Editors Picks</h1>
    </div>

    <?php echo do_shortcode('[qodef_portfolio_slider type="fullscreen-slider" order_by="date" order="ASC" category_ID="251" speed="2000"]'); ?>

    <div class="text-header">
        <h1>Fashion/Beauty</h1>
    </div>

    <div class="main-news">
        <?php $the_query = new WP_Query(array('posts_per_page' => 3, 'category_name' => 'Fashion-Beauty' ));

        while ($the_query -> have_posts()) {
        $the_query -> the_post(); ?>
            <div class="new-content">
                <div class="new-image"><?php the_post_thumbnail('full');?>
                <div class="new-content-excerpt">
                    <h5><?php
                        foreach ((get_the_category()) as $category){
                            echo $category->cat_name . ' '; 
                            }
                            ?>
                    </h5>
                    <h1><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h1>
                </div>
                </div>
            </div>
        <?php } ?>
    </div>


    <div class="text-header">
        <h1>Latest</h1>
    </div>


    <div class="main-news">
        <!-- Define our WP Query Parameters -->
        <?php $the_query = new WP_Query(array('posts_per_page' => 3, 'category_name' => 'technology' )); ?>

        <!-- Start our WP Query -->
        <?php while ($the_query -> have_posts()) {
         $the_query -> the_post(); ?>
            <div class="new-content">
            <!-- Display the Post Image with Hyperlink -->
                <div class="new-image"><?php the_post_thumbnail('full');?></div>
                <div class="new-content-excerpt">
                <!-- Display the Post Category Hyperlink -->
                    <h5><?php 
                    foreach((get_the_category()) as $category) {
                    echo $category->cat_name . ' ';
                    }
                    ?></h5>

                    <!-- Display the Post Title with Hyperlink -->
                    <h1><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h1>
                </div>

            </div>
            <!-- Repeat the process and reset once it hits the limit --
         >
        <?php } ?>
    </div>
     </div>
   </div>
   </div>       


   /*
   <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <?php if(($sidebar == 'default')||($sidebar == '')) : ?>
        <?php the_content(); ?>
        <?php do_action('kloe_qodef_page_after_content'); ?>
    <?php elseif($sidebar == 'sidebar-33-right' || $sidebar == 
    'sidebar-25-right'): ?>
        <div <?php echo kloe_qodef_sidebar_columns_class(); ?>>
            <div class="qodef-column1 qodef-content-left-from-sidebar">
                <div class="qodef-column-inner">
                    <?php the_content(); ?>
                    <?php do_action('kloe_qodef_page_after_content'); ?>
                </div>
            </div>
            <div class="qodef-column2">
                <?php get_sidebar(); ?>
            </div>
        </div>
    <?php elseif($sidebar == 'sidebar-33-left' || $sidebar == 'sidebar-25-left'): ?>
        <div <?php echo kloe_qodef_sidebar_columns_class(); ?>>
            <div class="qodef-column1">
                <?php get_sidebar(); ?>
            </div>
            <div class="qodef-column2 qodef-content-right-from-sidebar">
                <div class="qodef-column-inner">
                    <?php the_content(); ?>
                    <?php do_action('kloe_qodef_page_after_content'); ?>
                </div>
            </div>
        </div>
    <?php endif; ?>
<?php endwhile; ?>
<?php endif; ?>*/


    <?php get_footer(); ?>

    <script type="text/javascript">

    jQuery(window).load(function() {
    var container = document.querySelector('#container');
    var msnry = new Masonry( container, {
    itemSelector: '.masonryImage',
    columnWidth: '.masonryImage',                
  });  

    });


</script>

I want to apply a rule to my site that filters out all blog posts that are over 2 years old.

I see some solutions that involve manually putting posts into a category and hiding the category but I want a solution that is fully automated.

Is there a way to tell WP that whenever you grab posts to apply this rule:

if( !is_admin() ) { 
    select posts where post date > two-years-ago-today
}

Thanks