Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all 8245 articles
Browse latest View live

RippedSpine on "admin CV form field to insert in Post/Page"

$
0
0

Hello!

I hope this is the right place to ask :)

I'm trying to figure out how to create a form field in the admin area of WordPress, where the editor/user can create data concerning for example a Curriculum Vitae, and then insert the data into a Page or Post.

This is the concrete example I'm working with:
An artist's Curriculum Vitae where you can create custom forms for 'education', 'exhibitions', 'grants' etc.

And within each form field, the editor would be able to insert data for 'year', 'exhibition title', 'insitution', 'place' and so on depending on the title of the form.

Would also be nice to have the option to have text-fields for longer texts.

So I'm guessing one would first have to create a user interface for the field forms in the admin area, then have the data input posted to the database, and then write a function to retrieve the data from the tables created. (and I'm thinking of adding that function to a custom page template)....

On my search for solutions I've only come across plugins for contact forms and the like, nothing that would really work directly from the admin area. I'm also a bit conscious that I might be searching with the wrong set of keywords, so if any one of you might know or understand what I'm searching for, please nudge me in the right direction. :)

edit: moved this from the plugins/hacks forum, think this is more accurate...


kevinalves on "one page site set, but how do I get the posts to display in the right area?"

$
0
0

Hi
I am working on a one page site using smoothscroll, It's coming along nicely except one huge thing - I'm not sure how I am going to get the posts to display in the right areas

I am listing the pages like this:

// define how pages will display
$args = array(
	'sort_order' => 'ASC',
	'sort_column' => 'post_date', //post_title
	'hierarchical' => 1,
	'exclude' => '',
	'child_of' => 0,
	'parent' => -1,
	'exclude_tree' => '',
	'number' => '',
	'offset' => 0,
	'post_type' => 'page',
	'post_status' => 'publish'
);
$pages = get_pages($args);
//start loop

foreach ($pages as $page_data) {
    $content = apply_filters('the_content', $page_data->post_content);
    $title = $page_data->post_title;
    $slug = $page_data->post_name;
?>
<div id='<?php echo "$slug" ?>' class="section">
        <h1 class="page_title"><?php echo "$title" ?></h1>
			<?php echo "$content" ?>
</div>
<?php } ?>

If I query the posts and put a loop inside of the
<div id='<?php echo "$slug" ?>' class="section">
it will just post in every 'section'

Is there any kind of if post_category==page_title thing I can do to effectively query posts in this situation? I'm not terribly good at writing php, I usually can figure it out but I'm pretty stuck on this one, I'd appreciate any help.

here is a link to the development site

Thank you in advance

th90 on "Numbering posts based on each category"

$
0
0

Hi there.
I want to add continuous post numbers (IDs) for posts of each category seperately ,
mean :
category 1 : article 1,2,3,...
category 2 : article 1,2,3,...
and even if it's possible , changing the permalinks and ids of posts with these assigned numbers...
there is a tutorial here for adding continuous post numbers :
http://www.transformationpowertools.com/wordpress/continuous-post-numbers
but i want to do this for each category seperately...

Aya on "Keyboard post navigation with Cleaner (Lightbox) Post Gallery"

$
0
0

Hello,

I am trying to implement navigation between posts using the instructions here: http://reallysimpleworks.com/blog/navigating-between-blog-posts-with-jquery-keyboard-shortcuts/

It works, except I also have a lightbox post gallery on the page (using the Hatch theme). So if I open lightbox and navigate between photos using the left and right arrows, it triggers the navigation between blog posts already but only goes to the next page once the lightbox is closed.

I want to be able to keep these two navigation actions separate - perhaps having the post navigation be disabled while the lightbox is opened, though I'm not sure how this would be done.

Thanks so much in advance!

Aya

jashimili on "Custom login form to wordpress admin bar?"

$
0
0

Is there a way to add custom login form to wordpress admin bar, the point is that i need it custom and customizable so i can style it my own way.

I know there is easy solution with which i can add default form to admin bar but i can't customize it the way that i want to appear on admin bar.

But i don't know the solution how can i add it custom way.

So far i can add form like this

$form = wp_login_form( array(
'form_id' => 'adminloginform',
'echo' => false,
'label_username' => __(''),
'value_remember' => true
) );

$wp_admin_bar->add_menu( array(
'id' => 'login',
'title' => $form,
) );

But from the codex http://codex.wordpress.org/Function_Reference/wp_login_form there is not all data that i want to customize, for example in password field i can't remove label for password and insert Password text in text field. However i can do that for username field using

'label_username' => __(''),
'value_username' => __('Username'),

This will make label disappear and show Username in username text field but there is not value change for password field. Maybe it's because security reasons but this will save me some space that i need.

The current menu for login i use in separate drop down link and it looks like this

<?php _e('Login', 'vt-translate');?> <span class="caret"></span>
<div class="dropdown-menu dropdown" style="padding:8px">
<form class="form-horizontal" action="<?php echo get_option('home'); ?>/wp-login.php" method="post">
<div class="control-group">
<input type="text" id="inputUname" name="log" placeholder="Username" value="<?php echo wp_specialchars(stripslashes($user_login), 1) ?>">
</div>
<div class="control-group">
<input type="password" id="inputPassword" name="pwd" placeholder="Password">
</div>
<div class="control-group">
<label class="checkbox">
<input type="checkbox" name="rememberme" id="rememberme" checked="checked" value="forever" ><?php _e(' Remember me', 'vt-translate'); ?>
<input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>" />
</label>
/wp-login.php?action=lostpassword"><?php _e('Lost password?', 'vt-translate'); ?>
</div>
<button type="submit" class="btn btn-info" name="submit" value="Send"><?php _e('Login', 'vt-translate'); ?></button>
</form>
</div>

Some will recognize the code so yes the theme is based on bootstrap, and i tried to implement it in few various ways on to admin area but it just wont work. i tried to wrap the code, to use return function, to use echo function but none of the ways i tried won't work.

jonradio on "Checking URL is part of current WordPress site"

$
0
0

How do I determine (from within my plugin) whether a URL entered in a Settings field is part of the current WordPress site? i.e. - it points to a valid "page" (post/page/category page/image attachment page/Admin panel, etc.)

On one of my plugins' Setting pages, I allow Admins to copy and paste a URL from their Internet browser into a Settings field, because it is the simplest way for them to specify a page, post, category page, or any other WordPress-displayed "element" that they want my plugin to control.

get_page_by_path() and url_to_postid() are too "narrow" as they only cover Posts and Pages. Because most people use Permalinks, WP_Rewrite looks interesting, but I haven't figured out how to feed it my URL and get a response telling me if it exists (not 404 page) and whether it is a WordPress-displayed "page" (not someone else's .html or .jpg file).

brianoz on "Plugin generating virtual pages, issue with the_content not running"

$
0
0

I have a need to be able to generate fake/virtual/dynamic pages based on a url like http://www.mycinema.com/wpcinema/movie/MOVIEID to be able to display movies for cinemas with info on the movie and live session feed information.

After spending many hours researching, there doesn't seem to be much stuff written on how to do virtual pages in WordPress, so I will be writing up my experiences after getting this resolved!

So far, the current plan is to use the two filters - template_redirect to set the template to the current plugin's page.php template, and the_content to insert the content. The idea is to use the theme's template so the pages theme in well with the site.

(I got this approach from this excellent 2012 page from Xavi Esteve).

I have two problems:

  1. What is the best, most bullet proof, way to do this? Am I using the wrong approach? My thinking was that using the current theme's template was likely to provide the best current fit for the style of the website.
  2. TwentyTwelve does not appear to be calling the the_content filter in the context I'm using it. I suspect I'm doing something wrong, but cannot find the problem. This is probably closely related to question 1. TwentyTwelve definitely calls the_content for a normal page, and even an early add_filter() doesn't trigger in my code.

I discovered get_template_part() yesterday and wondered if I should be using that instead of manually looking in the child folder then the parent and running an include (not shown in the code below).

I wouldn't be asking, but I'm at my wit's end having googled extensively, possibly for the wrong search terms.

I've considered custom post types, but there are various complexities around this (including content that may change every few minutes) which means a dynamically generated page works much better.

This is an excerpt from the code I've written to explain the problem further:

add_action('parse_request', array(&$this, 'vm_parse_request'));

function vm_parse_request( &$wp )
{
    global $wp;
    if (empty($wp->query_vars['pagename']))
        return; // page isn't permalink

    $p = $wp->query_vars['pagename'];

    if (! preg_match("#wp-cinema/movie/([^/]+)#", $p, $m))
        return;

    // setup hooks and filters to generate virtual movie page
    add_action('template_redirect', array(&$this, 'vm_template_redir'));
    add_filter('the_content', array(&$this, 'vm_the_content'));
}

function vm_template_redir()
{
    // Reset currrently set 404 flag as this is a plugin-generated page
    global $wp_query;
    $wp_query->is_404 = false;

    $template = 'page.php';

    include(STYLESHEETPATH."/page.php"); // child
    // parent case left out for brevity

    exit;
}

function vm_the_content($content)
{
    return "my new content (actually generated dynamically)";
}

This is going to be an increasingly common thing in WordPress - can anyone offer suggestions or help? Anything is much appreciated.

36gianni36 on "Minotar"

$
0
0

Hi,

I wanted to add minotars as default avatars and added this in my function.php

if ( !function_exists('fb_addgravatar') ) {
function fb_addgravatar( $avatar_defaults ) {
$myavatar = "minotar.net/avatar/{$username}/60.png";
$avatar_defaults[$myavatar] = 'minotar';

return $avatar_defaults;
}

add_filter( 'avatar_defaults', 'fb_addgravatar' );
}
but wordpress returns minotar.net/avatar//60.png

How do I fix it?


Nerina-01 on "previous_posts_link not showing on page 2 while next_posts_link is."

$
0
0

I have a Static page set as front_page and I use a WP_Query the page template includes to display posts. I have a template part product-list.php and in it I have the following:

$paged = (get_query_var('page')) ? get_query_var('page') : 1;
$query = new WP_Query( array( 'paged' => $paged ) );
	$products_args = array (
		'post_type' => 'bb_product',
		'posts_per_page' => 3,
		'paged' => $paged
	);

And then after the $products_query loop:

<?php if ( $products_query->max_num_pages > 1 ) : ?>
    <div class="navigation">
        <?php
        // Bring $wp_query into the scope of the function
        global $wp_query;
        // Backup the original property value
        $backup_page_total = $wp_query->max_num_pages;
        // Copy the custom query property to the $wp_query object
        $wp_query->max_num_pages = $products_query->max_num_pages;
        ?>
        <div class="alignright"><?php next_posts_link('Next Entries'); ?></div>
        <div class="alignleft"><?php previous_posts_link('Previous Entries'); ?></div>
        <?php
        // Finally restore the $wp_query property to it's original value
        $wp_query->max_num_pages = $backup_page_total;
        ?>
    </div>
<?php endif; ?>

The problem is that when I am on page 1, I can see the next_posts_link, but when I am on page 2 there is still only the next_posts_link and no previous_posts_link (the HTML markup is there, but the link is missing). Even when I'm on the last page, there is only the next_posts_link (although there are no next posts) and no previous_posts_link.

I've read many threads with similar/same problems, but I can't solve it. This post helped me to show the navigation at all, before both links where missing.

My test site is here, to see it scroll down, the pagination has a red background.

Can somebody help or point me in the right direction?

Thank you.

rsangeethk on "All in one calendar plugin event description above event details"

$
0
0

I'm using Timely all in one event calendar.In the event details page i want the event description above the event details. so that i tried dragging the event details box in Edit Event(admin-side) but i cant able to drag to down is there any other way to change position in the coding?

http://wordpress.org/extend/plugins/all-in-one-event-calendar/

groncali on "appointment booking plugin with a credit system"

$
0
0

Hi Matt,

you could use Bookeo online bookings (http://www.bookeo.com), where you can assign credits from the back end, that can be redeemed against online bookings.

We do have a wordpress plugin.

Feel free to visit our website or send us an email at help@bookeo.com if you have any question.

Giovanna Roncali
Bookeo online bookings

Howdy_McGee on "Delete Images Attached To Page / Post"

$
0
0

When I delete a page or post I want to delete all images (from the media library) that are attached / associated with said page or post. I've hooked into Delete Posts and tried to query all attached images so I could delete them, but no luck. Anybody have suggestions?

function del_post_media($pid) {
$query = "DELETE FROM wp_postmeta
WHERE ".$pid." IN(
SELECT id
FROM wp_posts
WHERE post_type = 'attachment')";
global $wpdb;
if ($wpdb->get_var($wpdb->prepare($query))) {
return $wpdb->query($wpdb->prepare($query));
}
return true;
}
add_action('delete_post', 'del_post_media');

SimonKn on "JavaScript in the Widget Backend"

$
0
0

Hey,

I'm programming a little plugin with a widget. In the backend formular for this widget I have two radio buttons, which show/hide a div container, when you click on it.
On a other page of the plugin the exact same code works, but in the backend of the widget it doesn't work. Is JavaScript in den widget backend allowed?

function form($instance) {
?>
<input id="<?php echo $this->get_field_id('layout'); ?>" name="<?php echo $this->get_field_name('layout'); ?>" value="0" type="radio"<?php if($instance['layout']==0) echo ' checked="checked"'; ?> onclick="sPP_colors.style.display='none'" />
<!-- ... second radio button with display='block' instead of display='none' -->

<div id="sPP_colors" style="display:<?php echo ($instance['layout']==0) ? 'none;' : 'block;'; ?>">Stuff</div>
<?php
}

I hope you unterstand my problem and can help me.

mirgcire on "How make add-media insert an alternate audio shortcode?"

$
0
0

I prefer to use a downloaded audio plugin (Compact Audio Plugin) instead of the default. When I upload mp3 files using the add-media button, a shortcode is automatically installed: [audio mp3=something][/audio]. It would be nice if I could find a way to intercept and write this to the format of my prefered plugin.

Here is a list of the dead ends I have pursued:

The function add_shortcode ($tag, $arg ) will only change the attributes. Similarly the shortcode_atts_{$shortcode} filter only changes the attributes.

The wp_embed_handler_audio filter seems like a good fit, but it never gets called. I can not find any invocation of the function the applies this filter.

For a while I thought $shortcode_tags might be helpful, but it seems to be only a list of possible shortcodes rather that actual.

Also, I found lots of threads about how the 3.6 audio player has caused problems for lots of existing wp installations.

My last option would be a brute force regex in a filter of the the_content, but that seems to extreme.

Anyway, I would greatly appreciate some suggestions

silverbemr on "Editor Window, Change Default Size"

$
0
0

I know you can drag the corner and adjust the size. I want to set the default size to be about twice the default. I've looked up plenty of comments, tried all of them, no luck. I'm trying to find out what I'm supposed to edit to make this happen.

Thanks


oneruffryder on "How to add html div´s inside wordpost?"

$
0
0

Hi all, I need some help. The problem is, I decided to build a match stats which i want to insert in the proper wp posts.I build it with html and css.The issue is when i add the code of it, which contain div elements, it breaks the site layout and doesnt show properly what i build inside dreamweaver.From Dreamweaver in chrome browser preview all looks good,but not in wp.

This is just a working version (http://oi44.tinypic.com/fp2wys.jpg) which i tried to insert inside wp post.Also, i tried the plugin called Raw Html,and some others, but still no luck ..Any idea how I can do this, as i need to add it inside a lot of posts.

tonyfogarty on "Calling a page from within a page."

$
0
0

Hi,

I hope someone can help. My wordpress knowledge is limited - especially the Codex.

I'm building a page, where I want multiple content sections.

I've been using an 'apply_filters' function to get content, by passing the pagename as an argument. Since I'd like to call it dynamically I'm now stumped.

Here's what I'm after:
A page by the name of 'train' calls page 'train-a' and 'train-b' to incorporate their content into its page. Allowing the user to update 3 different page contents that can be styled in the theme into one page.

A page called 'buses' would call 'buses-a' and 'buses-b' and so on.

I'm writing this into the page template, so that the user can just add other clusters of pages as they need.

As I can't pass the pagename variable as an argument in the function (? I think? - it's not working), I'm lost.

Thanks in advance for any kindly pointers.

Tony

ps... needs to be slug or pagename, rather than ID, as user won't be able to set the page ID, but can set the slug.

danieliser on "Pretty URL for secure file serving using keys"

$
0
0

Trying to setup a secure file server using the following format
example.com/api/files/487s8ash5kask5378s

i can easily intercept /api/files with template redirects but this doesnt seem to leave me a way to get the key at the end. Any tutorials that i could convert to my use?

zappiDev on "Creating new data in Functions.php"

$
0
0

You will have to excuse the level of expertise! I am developing my first template for wordpress.

I am finding everything I need in books and google. But my biggest problem is adding stuff in the Functions.php.

Ok, basically what I want is an area in the dashboard to enable the user to add a large picture and a title. That's all.

I want to be able to call the picture and the title so I can place it in the html.

The development is in Parallax and between each section, i.e. blog, portfolio, contact etc there is a full browser screen image and a centred title.

I hope I am not sounding like an idiot, but I can only learn with some help. Thank You

lieutenantdan on "shortcode autop"

$
0
0

Whenever I try disabling WordPress's auto p for shortcodes it always stays on. It randomly inserts <p> tags inside an anchor tag and starts to create unexpected results.

I've tried moving the autop to after shortcodes using filters already and nothing yet.

Viewing all 8245 articles
Browse latest View live


Latest Images